- Input / output
- Decision making statements
Shoot a watermelon from a cannon and write a program in JAVA to compute the following given the initial velocity and initial angle of trajectory:
1. Maximum horizontal distance
2. Maximum vertical distance
3. Total travel time
4. Elapsed time when it reaches maximum vertical distance
5. In addition if there is an obstacle in its path, would the cannon ball clear it or not.
Initial velocity, initial angle (in degrees), the obstacle distance from the canon and the height of the obstacle is given by the user, use any way you like to ask for the data.
The user must be allowed to try different set of inputs as many times as desired.
x = vcos(x) * t
y= vcos(x) * t - (g*t/2)
Angles are in radians for the formals
radian=( degree * 3.14)/180
1. You must use methods for each of the above calculations.
2. You must use Dialog box for inputs from the user
3. Check the validity of input data
Initial velocity = ???
Initial angle = ????
Obstacle distance from the anon = ????
Obstacle height = ?????
Maximum horizontal distance = ?????