Question: JAVA ********** Distance, Speed, and Time You are tasked with creating a program for new students at your university. The program will assist the students
JAVA **********
Distance, Speed, and Time You are tasked with creating a program for new students at your university. The program will assist the students with arriving on time to class. The program will calculate distance, average speed, time in hours or minutes for any trip.
Requirements The program must use user-defined methods. These five methods are required, you can choose to have more 1. Method for calculating the distance 2. Method for calculating the average speed 3. Method for calculating time with result in hours 4. Method for calculating time with result in minutes 5. Method for printing the output of the result, only one method to be used All user inputs must be done in method main You may create an additional method for printing the menu, but it is not required. The options menu must be printed before each selection This statement Thank for using the average speed program! doesnt need to be in printing method
Formula and Units The formula to calculate average speed is speed = distance / time The user must enter distance in miles The user must enter time in hours, where 0.25 hours is equal to 15 minutes The user must enter speed in miles/hour To determine time in minutes instead of hours, multiply the result by 60
Input: Your program should prompt the user to make a selection from the options menu: o Please select an option from the menu: For Menu option 1, the user will be prompted for these inputs o Please enter the speed used for the travel in miles/hour: o Please enter the time traversed for the travel in hours: For Menu option 2, the user will be prompted for these inputs o Please enter the distance traveled in miles: o Please enter the time traversed for the travel in hours: For Menu option 3, the user will be prompted for these inputs o Please enter the distance traveled in miles: o Please enter the speed used for the travel in miles/hour: For Menu option 4, the user will be prompted for these inputs o Please enter the distance traveled in miles: o Please enter the speed used for the travel in miles/hour: For Menu option 5, there is no prompt
2 Output: The options menu o <<<<<>>>>>: o 1. Determine Distance (in miles) o 2. Determine Average Speed (in miles/hour) o 3. Determine Time (in hours) o 4. Determine Time (in minutes) o 5. Exit Menu Menu option 1 o The distance traveled is: (value)miles Menu option 2 o The speed used to travel is: (value)miles/hour Menu option 3 o The time traversed for the travel is: (value)hours Menu option 4 o The time traversed for the travel is: (value)minutes Menu option 5 o Thank for using the average speed program!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
