bonus concluded

This commit is contained in:
2026-07-30 08:39:07 +03:30
parent 6cb8f9a8d8
commit 01cca5f4ff
10 changed files with 213 additions and 10 deletions
+20
View File
@@ -21,12 +21,32 @@ public abstract class Vehicle {
}
// TODO: Create getters for all fields
public String getBrand() {
return brand;
}
public String getModel() {
return model;
}
public int getYear() {
return year;
}
public double getMileage() {
return mileage;
}
// TODO: Implement addMileage(double km)
public void addMileage(double km){
if(km<0){
System.out.println("error");
return;
}
this.mileage+=km;
}
// If km is negative → print error
// Otherwise increase mileage
// TODO: Declare abstract method getEnergyType()
public abstract String getEnergyType();
public void basicInfo() {
System.out.println(