Class VehicleInspector completed.
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
package org.util;
|
package org.util;
|
||||||
|
|
||||||
import org.*;
|
import org.model.Car;
|
||||||
|
import org.model.ElectricCar;
|
||||||
|
import org.model.GasCar;
|
||||||
|
import org.model.SportsCar;
|
||||||
import org.model.Vehicle;
|
import org.model.Vehicle;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -11,12 +14,10 @@ import org.model.Vehicle;
|
|||||||
public class VehicleInspector {
|
public class VehicleInspector {
|
||||||
|
|
||||||
public static void inspect(Vehicle v) {
|
public static void inspect(Vehicle v) {
|
||||||
|
|
||||||
v.basicInfo();
|
v.basicInfo();
|
||||||
|
|
||||||
// TODO:
|
if (v instanceof SportsCar) {System.out.println("Check brakes and performance");}
|
||||||
// If ElectricCar → print "Check battery system"
|
else if (v instanceof ElectricCar) {System.out.println("Check battery system");}
|
||||||
// If SportsCar → print "Check brakes and performance"
|
else if (v instanceof GasCar) {System.out.println("Check engine and oil");}
|
||||||
// If GasCar → print "Check engine and oil"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user