Parabola

  1. Let's extend the cannonball program so that it will plot the trajectory of the cannonball, as we did for the cos(x) function.
  2. You must have learned from high school mathematics that the trajectory of a projectile will take the shape of a parabola.


Enter the launch angle (in degrees): 30
Enter the initial velocity (in meters/sec): 20
Enter the initial height (in meters): 0
Enter the time interval between position calculations: 0.1
maxHeight = 5.10204

Time    xpos    ypos
0.0     0.0     0.0     *
0.1     1.7     1.0               *
0.2     3.5     1.8                       *
0.3     5.2     2.6                               *
0.4     6.9     3.2                                     *
0.5     8.7     3.8                                          *
0.6     10.4    4.2                                               *
0.7     12.1    4.6                                                   *
0.8     13.9    4.9                                                     *
0.9     15.6    5.0                                                       *
1.0     17.3    5.1                                                       *
1.1     19.1    5.1                                                       *
1.2     20.8    4.9                                                      *
1.3     22.5    4.7                                                    *
1.4     24.2    4.4                                                 *
1.5     26.0    4.0                                            *
1.6     27.7    3.5                                       *
1.7     29.4    2.8                                 *
1.8     31.2    2.1                          *
1.9     32.9    1.3                  *
2.0     34.6    0.4         *