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/s2).
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 ballβs 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 userβs input. The second function calculates t and y(t) and return y(t).