Question: IN JAVA THe FuelGauge Class - constructor accepts the startingamount of fueld entered by the user - 1 instance variable, the current aount of fuel
IN JAVA
THe FuelGauge Class
- constructor accepts the startingamount of fueld entered by the user
- 1 instance variable, the current aount of fuel in the car measured in gallons
- write getters and setters
Car Class
- constructor accept FuelGauge object as a parameter
- able to incrememnt the amount of fuel by 1 gallon (max of 10 gallons)
- able to decrementthe amount of fuel by gallon. If amount of fuel greater than 0 gallons
- write getters and setters
Driver class
- creates fuelgauge object, car object, and loop that reduces amount of fuel by 1 gallon every time it iterates until car runs out of gas. after each loop, print the current amount of fuel
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
