complete all TODO sections in SportsCar class

This commit is contained in:
2026-04-28 10:58:27 +03:30
parent 46939f6f38
commit 13e41f5f21
2 changed files with 16 additions and 12 deletions
+1 -1
View File
@@ -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;
+15 -11
View File
@@ -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");
}
} }