Answered step by step
Verified Expert Solution
Question
1 Approved Answer
SIDE NOTE: PLEASE USE C++ and THANK YOU IN ADVANCED!!! Question 12: You are told that a file named Data3.txt contains an unknown number of
SIDE NOTE: PLEASE USE C++ and THANK YOU IN ADVANCED!!!
Question 12: You are told that a file named Data3.txt contains an unknown number of lines of data. Each line contains a taxi ID, the miles driven and the gallons of gas used. Here is sample of a such a file (3 Points) 54 250 19 62 525 38 71 123 6 85 1322 86 97 235 14 Write a complete C++ program which reads the data from the file Data3.txt and displays on the screen the taxi ID, miles driven, gallons of gas used and miles per gallon (mpg) for each car which is the miles/gallons used. The output should also display the total miles driven, total gallons of gas used and the average mpg for all taxis. These totals should be displayed at the end of the output report. Your program should produce the following output to the screen for the sample data above. .C:Windowslsystem321c...O Miles Gas 250 525 123 1322 235 MPG 13 13 20 15 16 ID 19 38 6 86 14 4 2 5 2 otal miles driven 2455 otal gallons used 163 otal npg 15.8613 11 done!! Note a. Your code should work for any number of rows entered, not just for the data above. The example above is just a sample to illustrate the expected behavior of your program b. Comments are not necessaryStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started