complete all TODO sections in SportsCar class
This commit is contained in:
@@ -46,7 +46,7 @@ public class ElectricCar extends Car implements Chargeable {
|
|||||||
}
|
}
|
||||||
setChargeLevel(getChargeLevel() + amount);
|
setChargeLevel(getChargeLevel() + amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needsService(Vehicle v) {
|
public boolean needsService(Vehicle v) {
|
||||||
return getMileage() > 8000;
|
return getMileage() > 8000;
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
package org.model;
|
package org.model;
|
||||||
|
|
||||||
/*
|
|
||||||
* SportsCar extends GasCar.
|
|
||||||
*
|
|
||||||
* Special service logic for SportsCar:
|
|
||||||
* - needsService(): return true if mileage > 5000
|
|
||||||
* - performService():
|
|
||||||
* Print "High-performance brake system checked"
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class SportsCar extends GasCar {
|
public class SportsCar extends GasCar {
|
||||||
|
|
||||||
@@ -23,8 +15,20 @@ public class SportsCar extends GasCar {
|
|||||||
|
|
||||||
this.zeroToHundred = zeroToHundred;
|
this.zeroToHundred = zeroToHundred;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showDetails() {
|
||||||
|
super.showDetails();
|
||||||
|
System.out.println("acceleration time: " + this.zeroToHundred);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Override showDetails()
|
@Override
|
||||||
// Call super.showDetails()
|
public boolean needsService(Vehicle v) {
|
||||||
// Print acceleration time
|
return getMileage() > 5000;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void performService() {
|
||||||
|
System.out.println("High-performance brake system checked");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user