Complete inspect method of vehicle inspector class.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
package org.model;
|
||||
|
||||
public class HybridCar {
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package org.util;
|
||||
|
||||
import org.*;
|
||||
import org.model.ElectricCar;
|
||||
import org.model.GasCar;
|
||||
import org.model.SportsCar;
|
||||
import org.model.Vehicle;
|
||||
|
||||
/*
|
||||
@@ -14,6 +17,13 @@ public class VehicleInspector {
|
||||
|
||||
v.basicInfo();
|
||||
|
||||
if (v instanceof ElectricCar) {
|
||||
System.out.println("Check battery system");
|
||||
} else if (v instanceof SportsCar) {
|
||||
System.out.println("Check brakes and performance");
|
||||
} else if (v instanceof GasCar) {
|
||||
System.out.println("Check engine and oil");
|
||||
}
|
||||
// TODO:
|
||||
// If ElectricCar → print "Check battery system"
|
||||
// If SportsCar → print "Check brakes and performance"
|
||||
|
||||
Reference in New Issue
Block a user