For this program you will determine two launch angles for a certain range and also graph the trajectories. To understand the math you will be using in this program it might be good to review the derivation in the video below:
INPUTS:
A user will enter a launch velocity (V), vertical displacement (S) and a horizontal displacement (R).
A user will choose Above or Below the plane from a dropdown list.
OUTPUTS:
Graphical output of the two trajectories.
Print out of the two possible launch angles.
If a user puts in a very large range and a small velocity which is not capable of making that range your programming will give an error. In this case you should make it print some message instead.
Your graph should show values along the x and y axes.
CRITERIA & CONSTRAINTS:
Your program should have an impressive interface. (colors and graphics)
Specify in what units the user is entering data.
If you enter nothing into your (S) which means you are shooting and landing on the same plane, your angles should be complementary.
For this program you can re-use a lot of code from the Quadratic Solver and the CAT-Splat programs so less Pseudocode will be given.
Create an Above/Below data validation dropdown and set up all of your input variables.
If the dropdown chosen is "Below", make your S negative.
Calculate the angles using the quadratic. Check to see if the discriminant (stuff under radical) is negative. If it is, set message to "Out of Range".
To set up data table make arrays for ranges, S1 and S2. Also create variables range, time1, time2, height1 and height2 and set all of them to 0.
Create a variable R_increment and set it to the range/10.
Create a FOR loop from i=0 to i=10.
At the end of this loop add the R_increment to range each time.
At the beginning of the loop, calculate time1 and time2 based on the current range and each angle in radians.
Calculate height1 and height2 based on time1 and time2 respectively.
Push range to the ranges array
Push height1 to the S1 array
Push height2 to the S2 array
Add each row of data to a table on your spreadsheet.
Create your user interface and your graph of the trajectory data.