UMBC CMSC201, Computer Science I, Fall 1994 Sections 0101, 0102 and Honors

8 Step Plan for Project 2

If you find Project 2 large and intimidating, you should follow the following plan of attack and implement the project incrementally.

The 8 Steps

  1. Write a program that takes a real value x from the user and prints out sin(x).

  2. Add a for loop to the program, so it prints out sin(0*PI/32.0), sin(PI/32.0), sin(2*PI/32.0), sin(3*PI/32.0), ..., sin(64*PI/32.0).

  3. Modify the program above to calculate the number of asterisks you want to print out for each of the 65 lines. You have to round to the nearest integer. The number could be positive or negative. Store this number in a variable n. Check your program.

  4. Write a separate program that takes an integer n from the user and prints out that many asterisks in one line.

  5. Modify this second program, so that n could be positive or negative and you plot the asterisks on the correct side of the x-axis. Plot the x-axis too.

  6. Combine the two programs, so now you are plotting the sine curve.

  7. Change the program to allow the user to enter the amplitude.

  8. Change the program to allow the user to enter the frequency.

Last Modified: Thu Oct 6 09:35:14 EDT 1994

Richard Chang,