Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

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

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

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

7. Where Do We Begin?

Answered: 1 week ago

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago