Question: Car Instrument Simulator - Classes and Objects - C++ Design a set of classes that work together to simulate a cars fuel gauge and odometer.

Car Instrument Simulator - Classes and Objects - C++

Design a set of classes that work together to simulate a cars fuel gauge and odometer. The classes designed will include:

The FuelGauge class: this class will simulate a fuel gauge and will be responsible for:

1. Knowing the cars current amount of fuel in gallons

2. Reporting the cars current amount of fuel in gallons

3. Incrementing the amount of fuel by one (1) gallon (putting fuel in the car).

a. The car can hold a maximum of 15 gallons of fuel

4. Decrementing the amount of fuel by 1 gallon (if the amount of fuel is greater than 0 gallons (simulating burning fuel as the car runs).

The Odometer class: this class will simulate the cars odometer and will be responsible for :

1. Knowing the cars current mileage

2. Reporting the cars current mileage

3. Incrementing the cars current mileage by 1 mile

a. The maximum is 999,999 miles

b. When this amount is exceeded, the odometer resets the current mileage to zero

4. Working with the fuelGauge object

a. Decreasing the FuelGauge objects current amount of fuel by 1 gallon for every 24 miles travelled.

Requirements:

Create instances of each, and simulate filling the car up with fuel, and then run a loop that increments the odometer until the car runs out of fuel. During each loop iteration, output the cars current mileage and the current amount of fuel.

The program must use a separate *.h file and a separate *.cpp for the fuel gauge and for the odometer.so you will have five (5) files.

Car Instrument Simulator - Classes and Objects - C++ Design a set

nagement main.cppX! Odometer.h Xi Odometer.cpp X FueGauge.h | FueGauge.cpp Projects Symbols File I 7Chapter 14, Programming Challenge 15: Car Instrume #include 1 Workspace Lab5CarSim Sources #include "Odometer . h" 5 FuelGauge.cpp main.cpp Odometer.cpp using namespace std 7 Headers int main () uelbauge. 10 // Create a FuelGauge object FuelGauge fuel; Odometer.h

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!