Define a class called Odometer that will track fuel andmileage for an automotive
ID: 3609993 • Letter: D
Question
Define a class called Odometer that will track fuel andmileage for an automotive vehicle. The class should havemember variables to track the miles driven and he fuel efficientlyof the vehicle in miles per gallon. Include a mutator functionto reset the odometer to zero miles, a mutator function to set thefuel efficiently, a mutator function that accepts miles driven fora trip and adds it to the odometer’s total, and an accessorfunction that return the number of gallons of gasoline that thevehicle has consumed since the odometer was last reset. Useyour class with a test program that creates several trips withdifferent fuel efficiencies. You should decide which variablesshould be public, if any.Explanation / Answer
please rate - thanks #include class Odometer { public: void triplength(int miles); void MPG(double mpgget); double galused(void); void settozero(void); int totmiles; private: double mpg; }; int main() { Odometer trip; double gallons; int miles,n,i; double mpgget; char yesorno; coutn; for(i=1;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.