Question: solve in java please 7. Write a program to calculate the cost of a trip. The program prompts user to enter the distance in miles
7. Write a program to calculate the cost of a trip. The program prompts user to enter the distance in miles of the trip, the car efficiency in miles per gallon, and the cost of gas in dollars per gallon. Please limit the print out of the cost to two decimal digits using printf. The following are two sample runs. Sample run 1: Enter the driving distance: Enter miles per gallon: Enter price per gallon: The cost of driving is $20,00 Sample run 2: Enter the driving distance: Enter miles per gallon: Enter price per gallon: The cost of driving is $76.38
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
