CS 120 Lab 07
Tom Linton, http://www.cs.moravian.edu/~linton
Moravian College, Spring 1999

Assignment:

Briefly, by next Wednesday, March 3, 1999, you are to complete programming project number 1 on page 170 of the Koffman-Wolz textbook. This problem involves calculating the time it takes for a projectile to reach a target, and calculating the height of the projectile when it reaches the target (negative heights are meaningless, but may result). These calculations are based on the angle at which the projectile is launched, the initial velocity of the projectile, and the distance (along the ground) from the spot of launch to the target. All relevant formulas are included in the text and you will need to access several methods in the Math Class. You should include all class files (name.java) in a single text file called Flight.java, and submit that file using grade. In a comment at the top of Flight.java, explain the "packaging" of your text file. Is it a single class, two classes, etc. If you use multiple classes, write them as separate files, compile, run and test them separately. Only when you're ready to submit them should you combine them into a single text file and submit it with grade. In the submitted file, designate the start and end of different class files using a line of asterisks as markers, something like this:

/* End of Flight.java *******************************

/* Start of DoWork.java **************************** */

Your solution should generate two sets of inputs, using Math.random( ), with the following ranges:

and display both the randomly chosen input values and the calculated output values (time and height), in a meaningful and organized fashion. You may use either a SimpleGUI object for output, or several System.out.print( ) and-or System.out.println( ) statements.

While you are free to discuss your solutions with others, each person should write their own code, all "group work" should be clearly indicated in a comment at the top of the file, and each person must submit their own program. Do not forget to use plenty of comments in your files.