subject

Write python programs to solve the following two problems. your programs should be named according to the problem descriptions and pack them into a compression file.

1. design a class cannonball to model a cannonball that is fired into the air. a ball has
an x- and a y-position.
an x- and a y-velocity.
supply the following methods:
a constructor with an x-position (the y-position is initially 0)
a method move(sec) that moves the ball to the next position (first compute the distance traveled in sec seconds, using the current velocities, then update the x- and y-positions; then update the y-velocity by taking into account the gravitational acceleration of -9.81 m/sec2; the x-velocity is unchanged.)
methods getx and gety that get the current location of the cannonball
a method shoot whose arguments are the angle alpha and the y-velocity as v*sin(alpha); then keep calling move with a time interval of 0.1 seconds until the y-position is approximately 0; call getx and gety after every move and display the position; draw a figure to show the cannonball positions and trajectory.)
use this class in a program that prompts the user for the starting angle and the initial velocity. then call shoot. write the file called "cannonballdemo. py" to demonstrate your program is workable.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 15:10
What is word processing and word wrap?
Answers: 1
question
Computers and Technology, 21.06.2019 20:00
2.)how does a graphical user interface (gui) on a touchscreen interface differ from a gui on a desktop or laptop? a.)a finger or stylus is used instead of a pointer. b.) a magic wand is used instead of a pointer. c.)users speak commands instead of using a pointer. d.)users visualize commands instead of using a pointer.
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
Alex’s family members live in different parts of the world. they would like to discuss the wedding plans of one of their distant relatives. however, alex wants all the family members to talk to each other simultaneously so that they can make decisions quickly. which mode of internet communication should they use? a. blog b. email c. wiki d. message board e. instant messaging
Answers: 2
question
Computers and Technology, 23.06.2019 12:40
Curriculum exam to process a resident's payment, you must click on onesite payments home page. from the a. reports b. my settings o c.transactions o d. rent tab
Answers: 1
You know the right answer?
Write python programs to solve the following two problems. your programs should be named according t...
Questions
question
Mathematics, 21.04.2021 20:00
question
Mathematics, 21.04.2021 20:00
Questions on the website: 13722359