In: Computer Science
Write a code that takes the initial velocity and angle as an input and outputs the maximum height of the projectile and its air time.
Follow the pseudo code below. This will not be provided in as much detail in the future so you’ll have to provide pseudocode or a flowchart to showcase your logic. For this first assignment though, the logic is laid out below with some indented more detailed instructions.
PROGRAM Trajectory:
Establish the User Interface (Typically referred to as the UI);
INPUT INPUT
Solve Solve Print
Start with an explanation of activity
Ask the user for the initial velocity;
Ask the user for the initial angle;
Include descriptive requests for inputs so the user knows what information is required.
for the maximum height the ball reaches;
for the length of time the ball is in the air;
the answers for the user;
Include a description with that return so the user understands what the data is
Plot height versus time; Plot height versus distance;
Do not overwrite your previous figure! This is a new plot but you still want the old one.
Make it clear what the plots are. Label the plot axes with units, include a title, and use a marker for the plot points.
END
In above program
U is intial velocity
x is angle
ang is angle after converting into degrees
t is time
ALGORITHM
1.read intial velocity u
2. read angle x
3.convert angle into degrees
ang=X*PI/180
4. Calculate max height
h=u*u/2*g
5.calculate time
t=2*u*sin(ang)/g
Print max height
Print time