Question: Write a program which reads in the file, FleetInput.txt. I have given you a template for the program on the last page. The file is

 Write a program which reads in the file, FleetInput.txt. I havegiven you a template for the program on the last page. The

Write a program which reads in the file, FleetInput.txt. I have given you a template for the program on the last page. The file is on Canvas in this week's module under Materials. The fields to read in are vehicleID, miles, gallons. Here are some of the lines in the file. 279BX6KY2Z 582.2 802MX8B240 723.6 671AY6DZ3N 756.9 20.5 25.1 27.5 Your program should produce a report like: MPG AMSCO Fleet Report Vehicle ID Miles Gallons 279BX6KY2Z 582.2 20.5 802MX 8BZ4Q 723.6 25.1 .. more lines 28.4 28.8... Count: 13 Total Miles: 6751.3 Average MPG: 22.5 Vehicle ID with Best MPG: Vehicle ID with worst MPG: 199QW2 RP2Y 12 2AC6UG7P 36.3 15.6 Put.cpp file in dropbox. #include #include //Required for reading file! #include #include using namespace std; //DECLARATIONS SECTION - Reserved for constants int main() { 1/ declare required variables here // Before loop, display report header 1/ Insert loop here to read and process the text file. 1/ in the loop accumulate total miles, calculate average mpg // and determine the best and worst mpg and the vehicle that 17 produced them. // Also display the vehicleID, miles, gallons and mpg // After loop, display count, average, etc. return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!