Question: I need a complete working example that uses classes in C++ A car with a XX-gallon gas tank averages 21.5 miles per gallon when driven
I need a complete working example that uses classes in C++
A car with a XX-gallon gas tank averages 21.5 miles per gallon when driven in town and 27.3 miles per gallon when driven on the highway.
Write a program that calculates and displays the distance the car can travel on one tank of gas when driven in town and when driven on the highway.
It should have the following functions: getmileInfo The user will input the size of the gas tank, MPG in town and MPG on highway.
calcResults This function will calculate the distance the car can travel on one tank of gas for both town and highway.
distance = size of tank X average miles per gallon
printResults should print the distance the car can travel on one tank of gas for both town and highway driving.
The output should contain a description and then the numeric value for the distance variables.
The distance variables should be printed to 1 decimal place.
You must write the program with the above functions. Do not use global variables. Use a class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
