. Read all the question ( a, b, c, d) before answering. I have just bought a car
ID: 3540152 • Letter: #
Question
. Read all the question ( a, b, c, d) before answering.
I have just bought a car and I am interested in keeping up how much gas I use and the
mileage, that is the cost (the money I spent on gas) and my mileage. I will record
information each time I buy gas and record it in a file.
To process the data, I need a C++ structure to hold the data described. Each time I
purchase gas, I will record the: price(total price of purchased), gallons of gas purchased, and
my odometer reading (mileage). Ex input 50.00 20 56500 => ($50.00 of gas 20 gals
56500 current mileage on car.)
a. Define a structure and variable (an array of structs) to hold the gas data. There will only be 100 purchases made for this task so you will need to hold 100 purchases.
Assume that you have read the data into the structure you defined above. Using the
structure above:
b. Write a function to compute the total number of gallons of gas purchased.
c. Write a function that returns the number of miles I travel during this period.
d. Write the code to compute the average miles per gallon during this period. (Use the
values from b and c above. (computed as miles divided by gallons)
Explanation / Answer
may i help you??
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.