for those who know little bit of calculusit' not hard to derive formula that gives the position of our cannonball at any given moment in its flight rather than take the calculus approachhoweverour program will use simulation to track the cannonball moment by moment using just bit of simple trigonometry to get startedalong with the obvious relationship that the distance an object travels in given amount of time is equal to its rate times the amount of time ( rt)we can solve this problem algorithmically designing the program let' start by designing an algorithm for this problem given the problem statementit' clear that we need to consider the flight of the cannonball in two dimensionsheightso we know when it hits the groundand distanceto keep track of how far it goes we can think of the position of the cannonball as point (xyin graph where the value of gives the height above the ground and the value of gives the distance from the starting point our simulation will have to update the position of the cannonball to account for its flight suppose the ball starts at position ( )and we want to check its positionsayevery tenth of second in that intervalit will have moved some distance upward (positive yand some distance forward (positive xthe exact distance in each dimension is determined by its velocity in that direction separating out the and components of the velocity makes the problem easier since we are ignoring wind resistancethe velocity remains constant for the entire flight howeverthe velocity changes over time due to the influence of gravity in factthe velocity will start out being positive and then become negative as the cannonball starts back down given this analysisit' pretty clear what our simulation will have to do here is rough outlineinput the simulation parametersanglevelocityheightinterval calculate the initial position of the cannonballxposypos calculate the initial velocities of the cannonballxvelyvel while the cannonball is still flyingupdate the values of xposyposand yvel for interval seconds further into the flight output the distance traveled as xpos let' turn this into program using stepwise refinement the first line of the algorithm is straightforward we just need an appropriate sequence of input statements here' startdef main()angle eval(input("enter the launch angle (in degrees)")vel eval(input("enter the initial velocity (in meters/sec)") eval(input("enter the initial height (in meters)")time eval(input"enter the time interval between position calculations")