Question: 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
Get step-by-step solutions from verified subject matter experts
