Question: By using JAVA programming language Science P8.25 Design a class Cannonba11 to model a cannonball that is fired into the air. A ball has .
Science P8.25 Design a class Cannonba11 to model a cannonball that is fired into the air. A ball has . Anx-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 (double 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/s; the x-velocity is Amethod shot whose arguments are the angle and initial velocity v (Com- getY after every move and display the position.) unchanged.) Methods getx and getY that get the current location of the cannonball . . hex-velocity ast cos and the y-velocityasv ino; thenkeep callin pute t move witha Use this class in a program that prompts the user for the starting angle and the in velocity. Then call shoot
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
