Question
In this project you develop a computer model of a projectile that is fired with an initial angle of elevation and an initial speed v0
In this project you develop a computer model of a projectile that is fired with an initial angle of elevation and an initial speed v0 . In this model you will assume air resistance is negligible and that the only external force acting on the projectile is the force of gravity. In this case the graph of the trajectory will be a parabola. The way you will represent the trajectory is with a display of x,y-coordinates of the position of the projectile. The x,y-coordinates will be generated from the time of flight of the projectile. For example, if at time 10 seconds the x-coordinate was 100 and the ycoordinate was 150 then the ordered pair (100,150) would be on the graph of the trajectory.
You should create a class called trajectory that will define all variables and the arrays that will hold the x,y coordinates for a trajectory run. Your constructer should accept as input the initial angle of elevation , the initial speed v0 and the gravity constant g (9.8 if initial speed is in meters per second or 32 if the initial speed is in feet per second). Your constructor should call and internal private method that will run the trajectory storing all the x and y coordinates in arrays.
Run the model with the following three inputs
1. v0 = 840 meters per second, =60 degrees and g = 9.8
2. v0 = 500 meters per second, =45 degrees and g = 9.8
3. v0 = 300 feet per second, =30 degrees and g = 32
Note: The angles must be changed to radian measure before using them in the below formulas. The Equations The equations that generate the x, y coordinates for position are.
x = v0 ( cos)t where t is in seconds.
y = [v0 ( sin)t (1/2) g*t^2]
Other important equations are:
Maximum height
ymax = [v0*( sin)^2]/2g
Total Time of Flight
TOF = [2v0 sin]/g
Distance traveled by projectile.
range = [(v0^2)/g]*sin(2)
When your main program instantiates the trajectory object it should run a loop on time in seconds starting at time t=0 and calculate the x, y coordinates for the trajectory storing them in an array. Every 10 seconds of the trajectory display the time in seconds, the x-coordinate, and the y-coordinate. Your loop should iterate until the y-coordinate is less than or equal to 0. You object will have two arrays one for the x-coordinates and and one for y-coordinates. Each index will represent a time interval of 10 seconds. Array index 0 is time 0, array index 1 is time 10 seconds, array index 2 is 20 seconds and so on. The y-coordinate being less than or equal to 0 means the projectile hit the ground. Your class should have getters for all variables except for arrays holding the position coordinates.
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