Instructions 1. Use JGRASP to write, compile and run all code. 2. Save the compiled, error-free file as ClassExercise2.java.. (i.e. ClassExerciseMJ.java) 3. Be sure to use proper programming techniques such as line spacing, indentation and comments before each section describing each section. 4. Create a Java program "Road Trip Planner" which includes the following: a) Ask the user to enter the total driving distance in miles. b) Ask the user to enter driving distance in miles per hour. c) Ask the user to enter the total hours of the road trip. d) Display the estimated travel time in hours with two digits after the decimal point. Use Math.round() for more accuracy. e) Display the number hours and minutes that the user will stay at the destination. Use a constant to define the number of minutes per hour. (i.e. MINS_PER_HR) For the total number of minutes, consider only its integer part. (i.e. convert the total minutes to an integer) Make sure to match the EXACT output. Sample Output MEnter the driving distance: 500 MEnter the driving distance per hour: 55.5 4MEnter the number of hours for this trip: 72 MM&M MM MYour estimated travel time will be 9.01 hours. MM MYou will have 62 hours, and 59 minutes to stay at the destination.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 1DE
icon
Related questions
Question
Instructions
1. Use JGRASP to write, compile and run all code.
2. Save the compiled, error-free file as ClassExercise2<yourinitials>.java.. (i.e. ClassExerciseMJ.java)
3. Be sure to use proper programming techniques such as line spacing, indentation and comments before
each section describing each section.
4. Create a Java program "Road Trip Planner" which includes the following:
a) Ask the user to enter the total driving distance in miles.
b) Ask the user to enter driving distance in miles per hour.
c) Ask the user to enter the total hours of the road trip.
d) Display the estimated travel time in hours with two digits after the decimal point. Use Math.round()
for more accuracy.
e) Display the number hours and minutes that the user will stay at the destination.
Use a constant to define the number of minutes per hour. (i.e. MINS_PER_HR)
For the total number of minutes, consider only its integer part. (i.e. convert the total minutes to an
integer)
Make sure to match the EXACT output.
Sample Output
MEnter the driving distance: 500
MEnter the driving distance per hour: 55.5
4MEnter the number of hours for this trip: 72
MM&M
MM MYour estimated travel time will be 9.01 hours.
MM MYou will have 62 hours, and 59 minutes to stay at the destination.
Transcribed Image Text:Instructions 1. Use JGRASP to write, compile and run all code. 2. Save the compiled, error-free file as ClassExercise2<yourinitials>.java.. (i.e. ClassExerciseMJ.java) 3. Be sure to use proper programming techniques such as line spacing, indentation and comments before each section describing each section. 4. Create a Java program "Road Trip Planner" which includes the following: a) Ask the user to enter the total driving distance in miles. b) Ask the user to enter driving distance in miles per hour. c) Ask the user to enter the total hours of the road trip. d) Display the estimated travel time in hours with two digits after the decimal point. Use Math.round() for more accuracy. e) Display the number hours and minutes that the user will stay at the destination. Use a constant to define the number of minutes per hour. (i.e. MINS_PER_HR) For the total number of minutes, consider only its integer part. (i.e. convert the total minutes to an integer) Make sure to match the EXACT output. Sample Output MEnter the driving distance: 500 MEnter the driving distance per hour: 55.5 4MEnter the number of hours for this trip: 72 MM&M MM MYour estimated travel time will be 9.01 hours. MM MYou will have 62 hours, and 59 minutes to stay at the destination.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT