python program
This is a simple prototype program to predict the trajectory of a projectile under ideal conditions. You may assume that the projectile will have a constant velocity as it travels and that the only outside effect on the projectile will be due to the force of gravity. Thus the formula used to compute the time that it takes for the projectile to reach its target is:
Distance traveled
Time = -----------------------------------
Velocity * cos (angle of elevation in radians)
The distance the projectile is off the ground at the target's distance is calculated using the formula:
Height = Velocity * Time * sin (angle of elevation in radians)
Force of Gravity * Time * Time
- -------------------------
2
You will receive the following information from the user:
projectile velocity (feet / sec)
angle of elevation (degrees)
All values for one shot will be entered on one line of input. The program will continue reading input values until the user enters zeros for all values. Use the value of 32.17 as the constant for Gravity.
For each input set of values your program will indicate the trajectory of the projectile using the turtle graphics library.
Error handling: If a calculation cannot be performed (ie: a divide by zero would occur) your program needs to alert the user using the message:
The computed distance cannot be calculated with the given data