feat: add SportsCar specialization
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
package org.example.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 {
|
||||||
|
|
||||||
|
private double zeroToHundred;
|
||||||
|
|
||||||
|
public SportsCar(String brand, String model, int year,
|
||||||
|
double mileage, int seats,
|
||||||
|
double fuelLevel, String fuelType,
|
||||||
|
double zeroToHundred) {
|
||||||
|
|
||||||
|
super(brand, model, year, mileage, seats,
|
||||||
|
fuelLevel, fuelType);
|
||||||
|
|
||||||
|
this.zeroToHundred = zeroToHundred;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Override showDetails()
|
||||||
|
// Print header
|
||||||
|
// Call super.showDetails()
|
||||||
|
// Print acceleration time
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user