car-instrument simulator design a set of classes that work together to simulate a car's fuel gauge and
Question:
car-instrument simulator
design a set of classes that work together to simulate a car's fuel gauge and odometer. that classes you will design are as follows:
the FuelGauge class: it will know the car's current amount of fuel in gallons
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? report the car's current amount of fuel in gallons
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? be able to increment the amount of fuel by 1 gallon. this simulates putting fuel in the car( max 15 gallons)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? be able to decrement the amount of fuel by 1 gallon if the fuel is greater than 0 gallons
Odometer class: simulates the cars odometer
? ? ? ? ? ? ? ? ? ? ? ? ?know the cars current mileage
? ? ? ? ? ? ? ? ? ? ? ? ?report the cars current mileage
? ? ? ? ? ? ? ? ? ? ? ? ?able to increment the current mileage by 1 mile with the max odometer reading of 999,999 then resets to 0
? ? ? ? ? ? ? ? ? ? ? ? ?able to work with the FuelGuage object by decreasing the amount of fuel by 1 gallon every 24 miles
demostrate the classes by creating instances of each. simulate filling the car up with fuel, then run a loop that increments the odometer until the car runs out of fuel. during each loop iteration, print the car's current mileage and amount of fuel.
Managerial Accounting Creating Value in a Dynamic Business Environment
ISBN: 978-0078110917
9th edition
Authors: Ronald W. Hilton