class FuelGauge {
int putFuel()
{
int currentFuel = 4;
currentFuel = currentFuel + 1
;
if(currentFuel <= 15)
{
//System.out.println("car's current amount of fuel :" + currentFuel
+ " gallons");
return
currentFuel;
}
else
{
System.out.println("Maximum Fuel");
return 0;
}
}
int reduceFuel(int currentBurnFuel)
{
if(currentBurnFuel < 0)
{
System.out.println("No Fuel");
return 0;
}
else
{
int burn =
currentBurnFuel;
burn = burn -
1;
return
burn;
}
}
}
public class Odometer extends FuelGauge
{
int incrementMileage(int mileage)
{
int currentMileage = 300;
currentMileage = currentMileage +
mileage ;
if(currentMileage <= 99999
&& currentMileage > 0)
{
//System.out.println("car's current Mileage is :" +
currentMileage);
return
currentMileage;
}
else
{
currentMileage =
0;
//System.out.println("car's current Mileage is :" +
currentMileage);
return
currentMileage;
}
}
public static void main(String args[])
{
int CurrentFuel = 5;
FuelGauge fg = new
FuelGauge();
Odometer od = new Odometer();
int FuelLevel =
od.reduceFuel(CurrentFuel);
for (int j=0; j<=50; j++) //
instead of 50 maintain it 99999
{
System.out.println("Mileage: "+od.incrementMileage(j));
if((j%24)==0)
{
System.out.println("Fuel Leval: "+FuelLevel+"
gallons");
}
else
{
System.out.println("Fuel Leval: "+FuelLevel+"
gallons");
}
}
}
}
For this assignment, you will design tow classes that work together to simulate a car's fuel...
Car Instrument SimulatorFor this assignment, you will design a set of classes that work together to simulate a car’s fuel gauge andodometer. 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...
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 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:...
C# Car Instrument Simulation (Updated Question) Car Instrument Simulator 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 liters. o To report the car’s current amount of fuel, in liters. o To be able to increment the amount of...
Code to be written in JAVA please 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....
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...
Design a set of classes that work together to simulate the Stock Transaction System. You should design the following classes: 1. the StockMarket class. This class simulates the stock market such as Nasdaq, NYSD, or other stock market. The class's responsibility are as follows: -To know the stock market abbreviation, full name, location, an arraylist of stocks for this market 2. the Company class: this class simulates a company that has stock released on a stock market. The class's...
using java:
For this exercise, you will design a set of classes that work
together to simulate a parking officer checking a parked car
issuing a parking ticket if there is a parking violation. Here are
the classes that need to collaborate:
• The ParkedCar class: This class should
simulate a parked car. The car has a make, model, color, license
number. •The ParkingMeter class: This class should
simulate a parking meter. The class has three parameters:
− A 5-digit...
need code for this in java
Design a set of classes that work together to simulate the Stock Transaction System. You should design the following classes: 1. the StockMarket class. This class simulates the stock market such as Nasdaq, NYSD, or other stock market. The class's responsibility are as follows: -To know the stock market abbreviation, full name, location, an arraylist of stocks for this market 2. the Company class: this class simulates a company that has stock released on...
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...