Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The problem is connecting those 2 classes together like stated in the image below. Please help do number 2 public class OilGauge private int oilLevel:
The problem is connecting those 2 classes together like stated in the image below. Please help do number 2
public class OilGauge private int oilLevel: public int MAX_OIL = 5; public OilGauge (//constructor this.oilLevel = 5 > public int getoillevel00 return this.oillevel: > public void decrementOil Level if(this.oilLevel>O) this.oilLevel else System.out.println("You are out of oil. So oil cannt be decremented.") Second, update the Odometer class below. Add all statements necessary to decrement the oil every 500 miles public class Odometer { public final int MAX_MILEAGE = 999999; public final int MPG = 24; private int mileage; // current mileage private int setPoint; // used to remember when gallons should be decremented private int oilSetPoint = 0; private FuelGauge fuelGauge; public Odometer(int miles, FuelGauge fGauge) { mileage = miles; setPoint = miles; fuelGauge = fGauge; } public int getMileage() { return mileage; } public void incrementMileage() { if ((mileage - setPoint) >= MPG) { fuelGauge.decrementGallons(); setPoint = mileage; } }}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