Question
In Java - please comment the code well so I can follow the process This assignment is about aggregation and class collaboration. You will create
In Java - please comment the code well so I can follow the process
This assignment is about aggregation and class collaboration. You will create several Classes that will be part of an overall class named InstrumentDisplay.
The classes are FuelGage, Odometer, MilesSinceLastGas, and CruisingRange.
The FuelGage should assume a 15 gallon tank of gasoline and an average consumption of 1 gallon every 28 miles. It should increment in 1 gallon steps when you "add gas to the tank". It should decrement by 1 every 28 miles. It should display its current value. You should also have a display that shows how many miles traveled since you last added gasoline, MilesSinceLastGas, and a display for the estimated number of miles until you run out of gasoline, the CruisingRange.
The Odometer should keep track of total mileage from 0 to 999,999. After that it turns over back to 0. Make sure your code allows for this rollover. The overall class is to be named InstrumentDisplay. You may create the various outputs using System.out or JOptionPane. Make sure that account for both filling and emptying the tank. While your odometer will display in 1 mile increments, you should keep track of mileage internally in one tenth of a mile increments for purposes of computing gasoline remaining in the FuelGage and miles in the CruisingRange Please make sure you comment your code thoroughly. The code should be nicely formatted and should use proper variables.
1) You should start by showing the comments in your code that include your name, the class, and what the assignment is.
2) You should show all of your code. Slowly scroll through your code.
3) You must show your code compiling.
4) You must show your code running and completely test your program. If there are special inputs or outputs your program should check, please make sure you detail that your program can handle it.
5) If there is anything special you added to the program then please detail it.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started