You get a job to write a simulator program for NASA. They want to calculate the trajectories of projectiles and how the initial speed and angle from the horizontal affect the distance the projectile will travel on different planets and satellites. They plan to use this info to work on mass drivers, a method of launching and propelling space craft. Your program will draw a line graph to show the parabola traveled by a projectile. Your program will do this for three planets (or satellites).
There are some equations involved in this calculation, given below.
If a projectile starts with a certain speed
in meters per second, at a certain angle from the horizontal,
in radians, the total distance in meters (horizontal displacement)
that it travels is expressed as
To figure the height reached by the projectile (y) when it has covered a given horizontal displacement (x in meters),

Source of these equations: Wikipedia and here
And to convert from degrees to radians,

For the BONUS graphics part of the program, you will need these two equations.
To convert a number of meters (in the x, horizontal, direction) to a number of pixels on the graphics screen
To convert a number of meters (in the y, vertical, direction) to a number of pixels on the graphics screen
Both these equations assume the graphics screen is 640 by 480 pixels.
The user will input a speed in meters per second and an angle in degrees (a more convenient unit than radians). These numbers can have decimal places. The math functions sin and tan require radians as the unit for the argument.
See here for a table of gravitational constants for various planets and satellites. On this page, look at the table "Acceleration Due to Gravity Comparison", at the column marked "g". Use 3 different ones for 3 different planets / satellites in your program. You can choose any 3 that you like.
Your program will do the calculations and report the total distance traveled on each of 3 planets, the maximum height reached on the 3 planets, and then the largest distanced traveled and the highest height reached overall. For Bonus: a graph of the 3 parabolas will be displayed in the graphics window.
Example interaction with the user:
Trajectory Plotter! Enter a speed of launch (mps): 200 Enter the angle of launch (in degrees): 35 Speed = 200.00 mps, Angle = 35.00 degrees = 0.61 radians Distance travelled on Earth = 3831.57 m, max height = 670.72 m Distance travelled on Mars = 9970.21 m, max height = 1745.30 m Distance travelled on the Moon = 23202.29 m, max height = 4061.60 m Maximum distance traveled = 23202.29 Maximum height reached = 4061.60 For Earth, the 5 points of the parabola would be: x0, y0 (0.00, 0.00) x1, y1 (957.89, 503.04) x2, y2 (1915.79, 670.72) x3, y3 (2873.68, 503.04) x4, y4 (3831.57, 0.00) For Mars, the 5 points of the parabola would be: x0, y0 (0.00, 0.00) x1, y1 (2492.55, 1308.98) x2, y2 (4985.11, 1745.30) x3, y3 (7477.66, 1308.98) x4, y4 (9970.21, 0.00) For the Moon, the 5 points of the parabola would be: x0, y0 (0.00, 0.00) x1, y1 (5800.57, 3046.20) x2, y2 (11601.14, 4061.60) x3, y3 (17401.71, 3046.20) x4, y4 (23202.29, 0.00) Press any key to continue . . .
AND for the Bonus the program draws the arcs of the projectile's travels on 3 planets using the graphics library functions.
Design
Solve this problem without using loops. You should use the math library functions as needed. You must use the graphics library to output the drawing if you do the bonus. Use more than one named numeric constant. Use appropriate types for your variables. The penalty for using global variables is now 25 points!
NOTE: You MUST have PROTOTYPES for ALL the functions you write yourself. The penalty is also 25 points if you do not! This has been covered in class repeatedly!
You must write
START BONUS:
For Bonus, the next two functions convert (scale) meters to pixels
END BONUS
Overall Process:
Write a design for the program as pseudocode and include it as 'design.txt' in your submission. This should be the final design, not necessarily the one you show to the TA at the design lab session. Number the steps as 1, 1.1, 1.2, 2, 2.1, 2.2, 2.3, 3, 3.1, 3.2,....
At the start of the design lab you will be expected to have a rough design. It does not have to be complete but it has to exist and be at least two screens long. This must also be mailed to your TA by 9pm the day BEFORE the design lab in TEXT format. The design lab will be spent discussing designs. You are expected to participate in the discussion. It will be worth 6 points (6%) of the program 3 grade. The TA will decide how many of the 6 points you earn by your participation.
After the lab, from your design, write your code and compile it with a convenient compiler. Fix any errors. Make changes to your design as necessary, as you develop your code. Test your program well. Answer the questions given below about unusual inputs. Document the results. Submit all your work before the deadline!
Description of the Output
Note that this part is NOT bonus.
The output numbers all display 2 decimal places.
The distance and height for each planet is displayed.
The greatest distance and highest height for the 3 planets will be displayed.
Then the information about the parabola traveled on each planet will be displayed.
The 5 points on the parabola will be spaced out: at the origin (0, 0), a quarter of the
distance traveled, half the distance traveled, three quarters
of the distance and the full distance traveled.
You will have to calculate the height the projectile
reaches at each of the 5 points.
All of this information (5 x-y pairs) will be sent to the console window,
nicely labeled.
START Bonus: Then the parabolas will be displayed on the graphics window. Each output trajectory parabola will always have those 5 points plotted. Plot the points with a circle with a small radius. Use the line command to draw lines from one point to another. Use the outtextxy function to put the names of the planets on the graphics window. Use the setcolor function to make the 3 graphs for the three planets different colors. You scale the numbers to make them fit on the graphics window, using the scaling equations above. Hint: the numbers may fall outside of the window. If the shape of the curve that is visible is correct, don't worry about it. These scaling functions assume that no distance will be more than 10,000 meters and no height will be more than 2,000 meters. If these are exceeded, the parabola may be partly off the screen. END BONUS
Testing:
Write a test plan for your program. Use the same columns as in the examples done in class. Put it in a file called 'testplan.txt'. It does not have to be "tabular" as far as formatting. Just put the lines in the order 'Description', 'Input values', 'Expected Output' and 'Actual Output', with some space between each one.
Answer these questions in your documentation, in a separate text file 'unusualcases.txt'.
Capture at least 4 different runs. Make sure you label your test run captures, so that we can tell what is being tested. Labels are like "testing a large speed", "testing a negative angle".
Please read the documentation standard on the class web page. We will be looking to see how you meet these standards. In your documentation, mention what functions you use from which libraries. Document what your functions are doing and what the parameters mean.
As described in the documentation standard, Turn in electronically, zipped into one file,
Please, NO exe files, no folders!