Question
WRITE A C++ PROGRAM THAT WILL RUN IN CODEBLOCKS. The Dominion human cannonball show is coming to Norfolk, and you are asked to double-check their
WRITE A C++ PROGRAM THAT WILL RUN IN CODEBLOCKS.
The Dominion human cannonball show is coming to Norfolk, and you are asked to double-check their calculations to make sure no one gets injured! The human cannonball is fired from a cannon that is a distance from a vertical wall with a hole through which the cannonball must fly. The lower edge of the hole is at height 1 and the upper edge is at height 2. The initial velocity of the cannonball is given as 0 and you also know the angle of the cannon relative to the ground. Thanks to their innovative suits, human cannonballs can fly without air resistance, and thus their trajectory can be modeled using the following
() = 0 cos
() = 0 sin 1/2 ^ 2
where () and () provides the position of a cannon ball at time t that is fired from point (0,0). g is the acceleration due to gravity (g = 9.81 m/s 2 ).
Write an algorithm and a C++ program to determine if the human cannonball can make it safely through the hole in the wall. The inputs for the program are 0 , , , 1, 2.
0 must be between 0 and 100 m/s.
must be between 0 and 90 degrees.
The distance between the cannon and the wall must be between 0 and 1000.
H1 and H2 (0 < H1 < H2 < 1000) are the heights of the lower and upper edges of the wall.
To pass safely, there has to be a vertical safety margin of 1m both below and above the point where the balls trajectory crosses the centerline of the wall. Your program output Safe if the cannon ball can safely make it through the wall. Otherwise, output Not Safe!
You must use two functions other than the main function in your program. The first function reads the users input. The second function calculates t and y(t) and return
y(t). () = 0 cos
() = 0 sin 1 /2 ^2
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