Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAMMING LANGUAGE!!!!!! Make a design too like in the picture below for this program and also complete the programming. you need to create a

JAVA PROGRAMMING LANGUAGE!!!!!!

Make a design too like in the picture below for this program and also complete the programming. you need to create a diagram like this for this coding.

image text in transcribed

JAVA PROGRAMMING LANGUAGE!!!!

Car Instrument Simulator

For this assignment, you will design a set of classes that work together to simulate a car's fuel gauge and odometer. The classes you will design are the following:

The PuelGauge Class: This class will simulate a fuel gauge. Its responsibilities are as follows:

To know the car's current amount of fuel, in gallons.

To report the car's current amount of fuel, in gallons.

To be able to increment the amount of fuel by 1 gallon. This simulates putting fuel in the car. (The car can hold a maximum of 15 gallons.)

To be able to decrement the amount of fuel by 1 gallon, if the amount of fuel is greater than 0 gallons. This simulates burning fuel as the car runs.

The Odometer Class: This class will simulate the car's odometer. Its responsibilities are as follows:

To know the car's current mileage.

To report the car's current mileage.

To be able to increment the current mileage by 1 mile. The maximum mileage the odometer can store is 999,999 miles. When this amount is exceeded, the odometer resets the current mileage to 0.

. To be able to work with a FuelGauge object. It should decrease the FuelGauge object's current amount of fuel by 1 gallon for every 24 miles traveled. (The car's fuel economy is 24 miles per gallon.) Demonstrate the classes by creating instances of each. Simulate filling the car up with fuel, and 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.

ALSO: make sure that there are 3 class names. With these names:

car.java FuelGauge.java Odometer.java

AND DO NOT FORGET THE DIAGRAM PLEASE!

While planning a program, the programmer uses one or more design tools to create a model of the program. Three common design tools are hierarchy charts, flowcharts, and pseudocode. A hierarchy chart is a diagram that graphically depicts the structure of a pro- gram. It has boxes that represent each step in the program. The boxes are connected in a way that illustrates their relationship to one another. Figure 1-10 shows a hierarchy chart| for the pay-calculating program. Calculate Gross Pay Get Payroll Data from User Multiply Hours Worked by Pay Rate Display Gross Pay Read Number of Hours Worked Read Hourly Pay Rate A hierarchy chart begins with the overall task, and then refines it into smaller subtasks. Each of the subtasks is then refined into even smaller sets of subtasks, until each is small

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

8. Praise the trainees for their success in learning the task.

Answered: 1 week ago