(Misc. application)
a. The data in the following chart was collected on a recent automobile trip:
Mileage
Gallons
22,495
Full tank
22,841
12.2
23,185
11.3
23,400
10.5
23,772
11.0
24,055
12.2
24,434
14.7
24,804
14.3
25,276
15.2
Write a C++ program that accepts a mileage and gallons value and calculates the miles per gallon (mpg) for that segment of the trip. The mpg is obtained as the difference in mileage between fill-ups divided by the number of gallons of gasoline used in the fill-up.
b. Modify the program written for Exercise a to also compute and display the cumulative mpg after each fill-up. The cumulative mpg is calculated as the difference between the mileage at each fill-up and the mileage at the start of the trip divided by the sum of gallons used to that point in the trip.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.