BAGGINS Trucking maintains a trip file in which each record contains the following data: DRIVER name MILES driven on trip HOURS driven on trip Design an application that inputs records from the file (until reaching "eof") and, for each record, displays the DRIVER's name and the average Miles-per-Hours (MPH) for the trip where MPH is calculated by dividing the MILES by the HOURS. The program should also accumulate a GRAND total of the MILES driven. At the end, the program should display the GRAND total of the MILES driven. For example, if the trip file contained the following: Smith, 300, 5 Williams, 750, 10 Jones, 880, 11 then the program should display: Smith averaged 60 mph Williams averaged 75 mph Jones averaged 80 mph Grand total of miles is 1,930 Pseudocode:
BAGGINS Trucking maintains a trip file in which each record contains the following data:
DRIVER name
MILES driven on trip
HOURS driven on trip
Design an application that inputs records from the file (until reaching "eof") and, for each
record, displays the DRIVER's name and the average Miles-per-Hours (MPH) for the trip
where MPH is calculated by dividing the MILES by the HOURS. The program should also
accumulate a GRAND total of the MILES driven. At the end, the program should display
the GRAND total of the MILES driven.
For example, if the trip file contained the following:
Smith, 300, 5
Williams, 750, 10
Jones, 880, 11
then the program should display:
Smith averaged 60 mph
Williams averaged 75 mph
Jones averaged 80 mph
Grand total of miles is 1,930
Pseudocode:
Trending now
This is a popular solution!
Step by step
Solved in 2 steps