Question

Car Instrument Simulator

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 FuelGauge Class: This class will simulate a fuel gauge. Its responsibilities are as follows:

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

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

o To be able to increment the amount of fuel by I gallon. This simulates purring fuel in the

car. (The car can hold a maximum of 15 gallons.)

o To be able to decrement the amount of fuel by I 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 die cars odometer. Its responsibilities are as

follows:

o To know the car's current mileage.


o To report the car's current mileage.

o 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

o To he able to work with a FuelGauge object. It should decrease the FuelGauge object's

current amount of fuel by I gallon for ever)' 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.


0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Car Instrument Simulator
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • The assignment is to write a program in unix using C++ environment Car Instrument Simulator For this assignment you w...

    The assignment is to write a program in unix using C++ environment 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 FuelGauge Class: This class will simulate a fuel gauge. Its responsibilities are – To know the car’s current amount of fuel, in gallons. – To report the car’s current amount of fuel, in gallons. – To...

  • Assignment 4 Due Mar 22 by 11:59pmPoints 100 Submitting a file upload A4 OOP 2 "Car...

    Assignment 4 Due Mar 22 by 11:59pmPoints 100 Submitting a file upload A4 OOP 2 "Car Instrument Simulator" Access A4 from pdf assignment file & Turn in the following files: a4main.java FuelGauge.java Odometer.java program compile and run screenshots design document (including UML) A4 10. 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 Pue|Gauge Class:...

  • For this assignment, you will design tow classes that work together to simulate a car's fuel...

    For this assignment, you will design tow classes that work together to simulate a car's fuel gauge and odometer. The classes you will design are the following: 1. The FuelGauge Class: This class will simulate a fuel gauge. Its responsibilities are: 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 one gallon. This simulates putting fuel in the car....

  • In JAVA In this assignment you will use a class Car to represent a car that travels to various de...

    In JAVA In this assignment you will use a class Car to represent a car that travels to various destinations. Your car has a fuel economy rating of 32.3 miles per gallon. The gas tank holds 19.5 gallons. Your program will need to simulate two trips: 1) BC to Yosemite Valley, and 2) BC to Washington, D.C.. For each trip you will start with a full tank of gas. The output should look as follows. Trip one: Bakersfield College to...

  • Parking Ticket Simulator C++ HELP PLEASE

    For this assignment you will design a set of classes that work together to simulate a police officer issuing a parking ticket. The classes you should designare:• The ParkedCar Class: This class should simulate a parked car. The class’s responsibilities are:o To know the car’s make, model, color, license number, and the number of minutes that the car has been parked• The ParkingMeter Class: This class should simulate a parking meter. The class’s only responsibility is:o To know the number...

  • Write a program to compute miles per gallon of a car, over a long trip. The...

    Write a program to compute miles per gallon of a car, over a long trip. The car begins the trip with a full tank, and each fuel stop along the way fills the tank again. You will not do any math, arithmetic, or computations in the main() function. All output will be displayed from the main() function. Start the program by asking the user for the starting odometer reading. All odometer readings will be in whole miles only. The fuel...

  • Please help me with this exercises in JAVA, Thank you ===================== Parking Ticket Simulator Assignment =====================...

    Please help me with this exercises in JAVA, Thank you ===================== Parking Ticket Simulator Assignment ===================== For this assignment you will create a set of classes from scratch (no provided class files for this assignment) that work together to simulate a police officer issuing a parking ticket. You should design the following classes / functionality within them: ===================== ParkedCar.java: ===================== This class should simulate a parked car. The class's responsibilities are as follows: - To store the car's make, model,...

  • python code DC Final Project Implement a class Car with the following properties. A car has...

    python code DC Final Project Implement a class Car with the following properties. A car has a certain fuel efficiency (measured in miles/gallon) and a certain amount of fuel in the gas tank. The efficiency is specified in the constructor, and the initial fuel level is 0. The following two lines are written in a File called FuelEffic.txt (you have to read these from the txt file) Miles per gallon: 20 Tank Size (in gallons): 25 Therefore, based on these...

  • By Python 3 please 2. (a) Implement a class Student. For the purpose of this exercise,...

    By Python 3 please 2. (a) Implement a class Student. For the purpose of this exercise, a student has a name and a total quiz score. Supply an appropriate constructor and methods get Name, addQuiz(score), getTotalScore(), and getAverageScore(). To compute the latter, you also need to store the number of quizzes that the student took. (b) Modify the Student class to compute grade point averages. Methods are needed to add a grade and get the current GPA. Specify grades as...

  • I need help with this java project and please follow the instruction below. thank Class Project...

    I need help with this java project and please follow the instruction below. thank Class Project - Parking Ticket simulator Design a set of classes that work together to simulate a police officer issuing a parking ticket. Design the following classes: •           The ParkedCar Class: This class should simulate a parked car. The class’s responsibilities are as follows: – To know the car’s make, model, color, license number, and the number of minutes that the car has been parked. •          ...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT