41 lines
927 B
Java
41 lines
927 B
Java
package org.model;
|
|
|
|
/*
|
|
* Car extends Vehicle.
|
|
* This class SHOULD implement Serviceable.
|
|
*
|
|
* Service logic for Car:
|
|
* - needsService(): return true if mileage > 10,000
|
|
* - performService(): print "General car service completed"
|
|
*/
|
|
|
|
import org.behavior.Serviceable;
|
|
|
|
public abstract class Car extends Vehicle implements Serviceable {
|
|
|
|
private int seats;
|
|
|
|
public Car(String brand, String model, int year,
|
|
double mileage, int seats) {
|
|
|
|
// TODO: Call super constructor
|
|
this.seats = seats;
|
|
}
|
|
|
|
// TODO: Override getEnergyType() → return "Unknown"
|
|
|
|
// TODO: Override showDetails()
|
|
|
|
/*
|
|
* Implement Serviceable methods:
|
|
*
|
|
* needsService(Vehicle v):
|
|
* - Check the mileage of the current car
|
|
* - If mileage > 10000 return true
|
|
* - Otherwise return false
|
|
*
|
|
* performService():
|
|
* - Print: "General car service completed"
|
|
*/
|
|
}
|