Answered step by step
Verified Expert Solution
Question
1 Approved Answer
What is the java code for this task? Below is a simple execution of the program, where the characters in blue represent the user input.
What is the java code for this task?
Below is a simple execution of the program, where the characters in blue represent the user input. - Distance Calculation - Enter angle (deg) and speed (mph): 45 110 Enter gravity (m/s2): 0.1 Angle: 45.0000 (deg) Mph: 110.0000 ((m/h)) Gravity: 0.1000 (m/s2) Speed: 49. 1743 (m/s) Radian: 0.7854 (rad) Vertical Speed: 34.7715 (m/s) Horizontal Speed: 34.7715 (m/s) Upward Duration: 347.7147 (s) Total Duration: 695.4293 (s) Height : 6045.2740 (m) Distance: 24181.0959 (m) Here the characters appearing after : in Lines 2 and 3 are input that the user typed, and the characters appearing after : in other lines are the results of computation. The lines starting with On the Earth are the calculation for the Earth and the lines starting with Somewhere else are the calculation with the alternative gravity of 0.1 (the user entered this in Line 3). Lines 4-15 are the results of calculation that the program reports. To produce each outputline, the program uses the following format: System.out.printf("%26s:%11.4f (%) ", name, value, unit); llere, name, value, and unit are some data whose values the printf method uses in generating output. They are respectively String, double, and String The interpretation of the format is 25 character spaces for a String value, followed by a colon, followed by 11 character SACS for a floating point number with 4 digits after the decimal point, followed by one space, followed by a String inserted in a pair of matching parentheses, and then followed by the newline Your program should look like: import public class Throwing Ball ... void main(String[] args) ... variable declarations ... set up a Scanner ... prompt the user, and receive three parameters from her ... a bunch of calculation .. a bunch of System.out.printf statementsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started