complete workshop assignments
This commit is contained in:
@@ -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;
|
||||
|
||||
/*
|
||||
@@ -10,13 +13,16 @@ import org.model.Vehicle;
|
||||
|
||||
public class VehicleInspector {
|
||||
|
||||
public static void inspect(Vehicle v) {
|
||||
|
||||
public static void inspect(Vehicle v)
|
||||
{
|
||||
v.basicInfo();
|
||||
|
||||
// TODO:
|
||||
// If ElectricCar → print "Check battery system"
|
||||
// If SportsCar → print "Check brakes and performance"
|
||||
// If GasCar → print "Check engine and oil"
|
||||
switch (v)
|
||||
{
|
||||
case ElectricCar electricCar -> System.out.println("Check battery system");
|
||||
case SportsCar sportsCar -> System.out.println("Check brakes and performance");
|
||||
case GasCar gasCar -> System.out.println("Check engine and oil");
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user