implement project #1

Open
Fateme_Azizi wants to merge 10 commits from develop into master
Showing only changes of commit 89b43d8a0d - Show all commits
+28 -3
View File
@@ -20,13 +20,38 @@ public abstract class Vehicle {
this.mileage = mileage; this.mileage = mileage;
} }
// TODO: Create getters for all fields
// TODO: Implement addMileage(double km) public String getBrand() {
return this.brand;
}
public String getModel() {
return this.model;
}
public int getYear() {
return this.year;
}
public double getMileage() {
return this.mileage;
}
// If km is negative → print error // If km is negative → print error
// Otherwise increase mileage // Otherwise increase mileage
public void addMileage(double km) {
if(km<0) {
System.out.print("km cannot be negative");
}
else {
this.mileage += km;
}
}
public abstract String getEnergyType();
// TODO: Declare abstract method getEnergyType()
public void basicInfo() { public void basicInfo() {
System.out.println( System.out.println(