feat: implement Car inheritance

This commit is contained in:
2026-04-24 21:35:43 +03:30
parent b208cf62d4
commit 78734c46a0
+40
View File
@@ -0,0 +1,40 @@
package org.example.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.example.behavior.Serviceable;
public 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: Implement 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"
*/
}