Question: Java language 2. (10 points) Driving Cost Program Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several

Java language
2. (10 points) Driving Cost Program Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several tankfuls of gasoline by recording miles driven and gallons used for each tankful. De- velop a program that will input the miles driven and gallons used for each tankful. The program should calculate and display the miles per gallon obtained for each tankful. After processing all input information, the program should calculate and print the combined miles per gallon obtained for all tankfuls. Here is a sample input/output dialog: Enter the gallons used (-1 to end): 12.8 Enter the miles driven: 287 The miles/gallon for this tank was 22.4 Enter the gallons used (-1 to end): 10.3 Enter the miles driven: 200 The miles /gallon for this tank was 19.4 Enter the gallons used (-1 to end): Enter the miles driven: 120 The miles / gallon for this tank was 24.0 Enter the gallons used (-1 to end): -1 The overal11 average miles/gal1on was 21.6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
