Question: Implementing a C++ program that uses two (2) classes that work together to simulate a cars fuel gauge and odometer. Your solution should for this

Implementing a C++ program that uses two (2) classes that work together to simulate a cars fuel gauge and odometer.

Implementing a C++ program that uses two (2) classes that work together

to simulate a cars fuel gauge and odometer. Your solution should for

Your solution should for this assignment should consist of five (5) files:

FuelGauge.h (class specification file)

FuelGauge.cpp (class implementation file)

Odometer.h (class specification file)

Odometer.cpp (class implementation file)

assignment.cpp (application program)

Thank you in advance!

The classes you will design are: The FuelGauge Class: This class will simulate a fuel gauge. Its responsibilities are - To know the car's current amount of fuel, in gallons. - To report the car's current amount of fuel, in gallons To be able to increment the amount of fuel by 1 gallon. This simulates putting fuel in the car. (The car can hold a maximum of 15 gallons.) - To be able to decrement the amount of fuel by 1 gallon, if the amount of fuel is greater than O gallons. This simulates burning fuel as the car runs. The Odometer Class: This class will simulate the car's odometer. Its responsibilities are: - To know the car's current mileage. To report the car's current mileage. To be able to increment the current mileage by 1 mile. The maximum mileage the - odometer can store is 999,999 miles. When this amount is exceeded, the odometer resets the current mileage to 0. To be able to work with a FuelGauge object. It should decrease the FuelGauge object's - current amount of fuel by 1 gallon for every 24 miles traveled. (The car's fuel economy is 24 miles per gallon.)* The FuelGauge class should have at least one constructor, and the appropriate member functions to get the number of gallons, increment the number of gallons, and decrement the number of gallons. The odometer class should have at least one constructor, and the appropriate member functions to get the mileage and increment the mileage (unfortunately you cannot decrement the mileage!) *In the odometer class, you can have a member variable that is a pointer to a FuelGauge object. This is how you can establish a relationship between the two classes that allows them to work together. For every mile the car is driven, the odometer is increased by 1, and for every 24 miles the car is driven, the number of gallons is reduced by one. So in the Odometer class, one of the private member variables should be of type FuelGuage* (pointer to a FuelGauge object)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!