Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java mathmatically, and visually represent a cannon ball shooting. (Without importing any packages) Cannonball Design a class Cannonball to model a cannonball that is

image text in transcribed
In java mathmatically, and visually represent a cannon ball shooting. (Without importing any packages)
Cannonball Design a class Cannonball to model a cannonball that is fired into the air. A ball has An x-and a y-position Anx- and a y-velocity Supply the following methods A constructor with an x-position (the y-position is initially 0) . A method move(double deltaSec) that moves the ball to the next position. First compute the distance traveled in deltaSec seconds, using the current velocities, then update thex- and y-positions; then update the y-velocity by taking into account the gravitational acceleration of-9.81 m/s2; the x-velocity is unchanged .A method Point getLocation) that gets the current location of the cannonball, rounded to integer coordinates . A method ArrayList shoot(double alpha, double v, double deltaSec) whose arguments are the angle a and initial velocity v. (Compute the x-velocity as v cos a and the y-velocity as v sin a; then keep calling move with the given time interval until the y- position is 0; return an array list of locations after each call to move.) Use this class in a program that prompts the user for the starting angle and the initial velocity Then use shoot function and draw the trajectory of the cannonball

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions