Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab Goal : This lab was designed to teach you more designing and writing classes. Use the same runner code below and associated comments to
Lab Goal : This lab was designed to teach you more designing and writing classes. Use the same runner code below and associated comments to create a Car class. Lab Description : Write a Car class that will keep track of miles driven and when you need to change your oil.
this is my code, but I dont want to use "this." in my code
public class Car
private int milesDriven;
private int oilChange;
private int lastOilChangeMileage;
public Carint initialMiles, int oilChange
this.milesDriven initialMiles;
this.oilChange oilChange;
this.lastOilChangeMileage ;
public boolean timeForOilChange
if milesDriven lastOilChangeMileage oilChange
lastOilChangeMileage milesDriven;
return true;
else
return false;
public void addMilesint additionalMiles
milesDriven additionalMiles;
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