develop #1

Open
HadiSharifi wants to merge 8 commits from develop into master
Showing only changes of commit 2267f37d0d - Show all commits
+11 -10
View File
@@ -1,10 +1,5 @@
package org.model;
/*
* Abstract base class for all vehicles.
* This class DOES NOT implement Serviceable.
* Service behavior will be defined in concrete subclasses.
*/
public abstract class Vehicle {
@@ -20,13 +15,18 @@ public abstract class Vehicle {
this.mileage = mileage;
}
// TODO: Create getters for all fields
public String getBrand() { return this.brand; }
public String getModel() { return this.model; }
public int getYear() { return this.year; }
public double getMileage() { return this.mileage; }
// TODO: Implement addMileage(double km)
// If km is negative → print error
// Otherwise increase mileage
public void addMileage(double mileage) {
if (mileage < 0) {
throw new IllegalArgumentException("Mileage cannot be negative");
}
this.mileage += mileage;
}
// TODO: Declare abstract method getEnergyType()
public void basicInfo() {
System.out.println(
@@ -37,4 +37,5 @@ public abstract class Vehicle {
}
public abstract void showDetails();
public abstract String getEnergyType();
}