Question: In C++ : ** please include car class ** For this assignment you will design a set of classes that work together to simulate a

In C++ :

In C++ : ** please include car class ** For this assignment

** please include car class **

For this assignment you will design a set of classes that work together to simulate a car with a fuel gauge and odometer. 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 0 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 theodometer 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'sfuel economy is 24 miles per gallon.) The Car class: This class will simulate a car. Its responsibilities are: To act as a container for instances of the FuelGauge and Odometer objects, To create the necessary FuelGauge and Odometer objects as part of its construction. Be able to simulate filling up the car by specifying an amount and putting that much fuel into the car or the maximum amount whichever is smaller, o Be able to simulate driving by specifying a distance and using a loop to increment the odometer one mile at a time until the distance is met or it runs out of fuel. During each increment of the loop the milage on the odometer and the remaining fuel should be displayed on the screen. Demonstrate the classes by creating instances of Car, filling each with fuel, and driving them

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!