Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java Problem 2 Projectile Motion Simulation Suppose a projectile is fired straight up into the air with an initial velocity of vo. The physics formula
java
Problem 2 Projectile Motion Simulation Suppose a projectile is fired straight up into the air with an initial velocity of vo. The physics formula for computing its height after t seconds is h(t) o-0.5 g 2, where g is the gravitational force of the earth (g 9.81m/sec. We want to verify this formula by using a computer simulation. Starting with an initial height of zero and an initial velocity input by the user we want to display snapshots of the projectile's height, allowing the user to compare the simulated flight of the projectile to the height computed using the physics formula. In the simulation, we want to track the projectile's height and velocity after every (very short) time interval (use 1/100th of a second as the interval). The simulation will track the velocity and height after each interval using different formulas than the physics formula. So, after each interval, the simulation will compute . The distance the projectile moves as (1 v- The height of the projectile The new velocity (updated each interval due to gravity). This can be computed as We use a while loop to control the simulation's time ticks, continuing until the projectile falls back to earth (it's height is zero or less). Although you will update the height and velocity 100 times per second, your program should only display results every second2. The data displayed in each snapshot (see the sample output below) should include the time, current velocity, and projectile's height computed two ways: via your simulation and via the physics formula. At the end of the simulation, the program should report the maximum height achieved by the projectile. You will have to keep track of this in a variable and check to see if it needs to be updated at each interval Here is a sample run with a sample initial velocity of 100.0 meters/second. Projectiles initial velocity? 188. ime (s) Vel(n/s) Height (sim) Height(formula) 100.800 90.190 80.380 70.570 60.760 50.950 41.140 31.330 21.520 11.710 1.900 7.910 8.800 95,144 180,478 256.802 321.716 377.620 23.714 459.998 486,472 583.136 509.998 507,835 494.269 471.693 439.307 397.111 345.105 283.289 211.663 130.227 38.981 8,800 95,895 180,380 255,855 321.520 377.375 423,428 459.655 486.088 582.695 509,588 586,495 493.680 471.055 438,620 396.375 44.328 282.455 210.780 129,295 38,000 -17.72 27.530 37.340 -47.150 56.960 66.770 -76.580 -86.390 -96.200 13 14 18 20 ximum height achieved was: 518.184 metersStep 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