Define a class called odometer that will track fuel and


Problem

Define a class called Odometer that will track fuel and mileage for an automotive vehicle. The class should have member variables to track the miles driven and the fuel efficiency of the vehicle in miles per gallon. Include a mutator function to reset the odometer to zero miles, a mutator function to set the fuel efficiency, a mutator function that accepts miles driven for a trip and adds it to the odometer's total, and an accessor function that returns the number of gallons of gasoline that the vehicle has consumed since the odometer was last reset. Use your class with a test program that creates several trips with different fuel efficiencies. You should decide which variables should be public, if any.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Define a class called odometer that will track fuel and
Reference No:- TGS02745806

Expected delivery within 24 Hours