- #1
riza
- 1
- 0
hi
I am having trouble doing this assignment. I have very little knowledge of c++ and the truth is i don't even know where to begin. Can someone please help me with it. the program I am supposed to be writing is as follows:
compute the height of a projectile that was launched.
You will recall the tutorial problem in which you computed the height of a projectile
that was launched “straight up”. In this case the height after t seconds is given by:
2
2
s u t 1 gt o = −
Where uo is the launch velocity in m/s and the gravitational constant g is 9.8 m/s2.
In the simulation of the motion of the projectile the movement is monitored in very
short time intervals Δt. In a short time interval the velocity v is almost constant and
the distance the projectile moves can be computed as Δs = v Δt. The position can then
be updated by s = s + v * Δt ;
The velocity changes constantly, it is reduced by the gravitational force. In a short
time interval, Δv = -g Δt, and the velocity must be updated as v = v – g * Δt ;
In the new iteration the new velocity is used to update the distance.
However, most projectiles are not shot upright but at an angle to the horizontal. If the
starting velocity has magnitude v and the starting angle of α, then the velocity is a
vector with components vx = v cos α, vy = v sin α.
In the x-direction the velocity does not change. In the y-direction the gravitational
force has an effect. These equations presume there is no air resistance.
Write a program that will perform the simulation of a projectile that has been
launched with an initial velocity and angle. The user is to enter the initial velocity between (between 0 & 100 m/s) and launch angle (between 50 and 850).
The program will present the results in two formats. The user should be able to choose
which format to view.
1. Print the results in a table format on the screen, showing the height (y position)
and range (x position) at each time interval. Update the position every 100
times/second, but print out the position only every full second. Repeat until the
projectile has reached the ground level.
2. Plot the position of the projectile on the screen.
- Use a character display, similar to the sine wave example given earlier.
- The display should plot the x-axis of the projectile on the horizontal
plane of the screen and y-axis on the vertical plane of the screen.
- Hint: You could store the projectile position in a 2 dimensional array
that can represent the projectile positions on the screen. The contents
of the array can then be printed to the screen.
Deleted: ,
Deleted: and the time interval
Deleted: Use the time interval to
u
the reason I am posting the whole thing is beause i got no idea where to even start. thanx
I am having trouble doing this assignment. I have very little knowledge of c++ and the truth is i don't even know where to begin. Can someone please help me with it. the program I am supposed to be writing is as follows:
compute the height of a projectile that was launched.
You will recall the tutorial problem in which you computed the height of a projectile
that was launched “straight up”. In this case the height after t seconds is given by:
2
2
s u t 1 gt o = −
Where uo is the launch velocity in m/s and the gravitational constant g is 9.8 m/s2.
In the simulation of the motion of the projectile the movement is monitored in very
short time intervals Δt. In a short time interval the velocity v is almost constant and
the distance the projectile moves can be computed as Δs = v Δt. The position can then
be updated by s = s + v * Δt ;
The velocity changes constantly, it is reduced by the gravitational force. In a short
time interval, Δv = -g Δt, and the velocity must be updated as v = v – g * Δt ;
In the new iteration the new velocity is used to update the distance.
However, most projectiles are not shot upright but at an angle to the horizontal. If the
starting velocity has magnitude v and the starting angle of α, then the velocity is a
vector with components vx = v cos α, vy = v sin α.
In the x-direction the velocity does not change. In the y-direction the gravitational
force has an effect. These equations presume there is no air resistance.
Write a program that will perform the simulation of a projectile that has been
launched with an initial velocity and angle. The user is to enter the initial velocity between (between 0 & 100 m/s) and launch angle (between 50 and 850).
The program will present the results in two formats. The user should be able to choose
which format to view.
1. Print the results in a table format on the screen, showing the height (y position)
and range (x position) at each time interval. Update the position every 100
times/second, but print out the position only every full second. Repeat until the
projectile has reached the ground level.
2. Plot the position of the projectile on the screen.
- Use a character display, similar to the sine wave example given earlier.
- The display should plot the x-axis of the projectile on the horizontal
plane of the screen and y-axis on the vertical plane of the screen.
- Hint: You could store the projectile position in a 2 dimensional array
that can represent the projectile positions on the screen. The contents
of the array can then be printed to the screen.
Deleted: ,
Deleted: and the time interval
Deleted: Use the time interval to
u
the reason I am posting the whole thing is beause i got no idea where to even start. thanx