Question: Car Instrument Simulator For this assignment, you will create a set of classes that work together to simulate a car s fuel gauge and odometer.
Car Instrument Simulator
For this assignment, you will create a set of classes that work together to simulate acars fuel gauge and odometer. The classes you will design are the following:
The FuelGauge Class: This class will simulate a fuel gauge. Its responsibilities are as follows:
To know the cars current amount of fuel, in gallons. To report the cars current amount of fuel, in gallons. To be able to increment the amount of fuel by gallon. This simulates putting fuel in the car. The car can hold a maximum of gallons. To be able to decrement the amount of fuel by gallon if the amount of fuelis greater than gallons. This simulates burning fuel as the car runs.
The Odometer Class: This class will simulate the cars odometer. Its responsibilities are as follows:
To know the cars current mileage. To report the cars current mileage. To be able to increment the current mileage by mile. The maximum mileage the odometer can store is miles. When this amount is exceeded, the odometer resets the current mileage to To be able to work with a FuelGauge object. It should decrease the FuelGauge objects current amount of fuel by gallon for every miles traveled. The cars fuel economy is miles per gallon.
Demonstrate the classes by creating instances of each. Simulate filling the car up withfuel and then run a loop that increments the odometer until the car runs out of fuel.During each loop iteration, display the cars current mileage and amount of fuel.
Do this using C # Visual Studio and Windows forms no Console.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
