complete all TODO sections in SportsCar class
This commit is contained in:
@@ -1,13 +1,5 @@
|
||||
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 {
|
||||
|
||||
@@ -24,7 +16,19 @@ public class SportsCar extends GasCar {
|
||||
this.zeroToHundred = zeroToHundred;
|
||||
}
|
||||
|
||||
// TODO: Override showDetails()
|
||||
// Call super.showDetails()
|
||||
// Print acceleration time
|
||||
@Override
|
||||
public void showDetails() {
|
||||
super.showDetails();
|
||||
System.out.println("acceleration time: " + this.zeroToHundred);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsService(Vehicle v) {
|
||||
return getMileage() > 5000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performService() {
|
||||
System.out.println("High-performance brake system checked");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user