Question
If a projectile is fired or thrown upwards at a known velocity, its entire trajectory can be accurately computed. You probably remember the physics formula
If a projectile is fired or thrown upwards at a known velocity, its entire trajectory can be accurately computed. You probably remember the physics formula h = v t g t 2 (h is the projectiles height at any given time, v is the initial upwards velocity, t is the time elapsed since it was fired or thrown, and g is the acceleration due to gravity, an approximate constant anywhere on the surface of the earth). If you measure h in feet, t in seconds, and v in feet per second, g is about 32.174. Obviously this is going to be a very important formula for this program. One of the most important aspects of good programming is to make separate functions for all the important things. So make a good start: write a clear and simple function that takes values for v and t as parameters, and calculates and returns the corresponding value of h. Think about what types the parameters and other constants should have for an accurate calculation. Test your function thoroughly. It may be difficult to think of good values for testing. If you remember calculus you can work things out exactly, but velocities between 100 and 200 feet per second should keep the cannon ball in the air for a few seconds. The exact formula for how long the ball stays in the air, when there is no atmosphere to slow it down is (2 v / g) seconds.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started