Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis In Microsoft Excel

Authors: Alex Holloway

1st Edition

B0CCCPKTTX, 979-8852388452

More Books

Students also viewed these Databases questions

Question

an element of formality in the workplace between different levels;

Answered: 1 week ago