Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

east-1.amazonaws.com blackboard learn. ythos prod 590a44cba67c7/649407?response

ID: 3753537 • Letter: E

Question

























east-1.amazonaws.com blackboard learn. ythos prod 590a44cba67c7/649407?response content dispositions inline%3B%20filename%2A% xercise 4: Write some code 8. Write a Python Program to calculate the travel distance of a cannonball with the initial velocity v meters per second aimed at d degrees. The program prompts the user for v and d. Assume that the ground is flat, and there is no air resistance. Test your program with v = 860 meters/second and d = 45 degrees. Use 9.8 m/sec for gravity. Recall that the input to trigonometry functions must be given in radian. Hint: Find vdx and time to reach the crest (where vy 0). Total travel time = 2× the time to the crest. Travel distance = v:X travel time. 7. 2 Ux vy e ooperman-1-01590...Wav

Explanation / Answer

import math
def main():
#taking input
v=float(input("Enter v: "))
d=float(input("Enter d: "))
radians = d*3.142/180 #converting degree to radians
vx=v*math.cos(radians) #x-component of velocity
vy=v*math.sin(radians) #y-component of velocity
g=9.8
t=vy/g #time to reach the crest
totalDistance=vx*2*t
  
print 'Total Distance= ',totalDistance
  
  
  
if __name__ == '__main__':
main()
  

Sample output: