develop #1

Open
HadiSharifi wants to merge 8 commits from develop into master
Showing only changes of commit 3a7e3ebea5 - Show all commits
+13 -8
View File
@@ -1,12 +1,12 @@
package org.util; package org.util;
import org.*; import org.*;
import org.model.ElectricCar;
import org.model.GasCar;
import org.model.SportsCar;
import org.model.Vehicle; import org.model.Vehicle;
/*
* Utility class to inspect vehicles.
* Demonstrates instanceof and polymorphism.
*/
public class VehicleInspector { public class VehicleInspector {
@@ -14,9 +14,14 @@ public class VehicleInspector {
v.basicInfo(); v.basicInfo();
// TODO: if (v instanceof ElectricCar) {
// If ElectricCar → print "Check battery system" System.out.println("Check battery service");
// If SportsCar → print "Check brakes and performance" }
// If GasCar → print "Check engine and oil" else if (v instanceof SportsCar) {
System.out.println("Check brakes and performance");
}
else if (v instanceof GasCar) {
System.out.println("Check engine and oil");
}
} }
} }