complete VehicleInspector class
This commit is contained in:
@@ -24,9 +24,6 @@ public class SportsCar extends GasCar {
|
|||||||
this.zeroToHundred = zeroToHundred;
|
this.zeroToHundred = zeroToHundred;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Override showDetails()
|
|
||||||
// Call super.showDetails()
|
|
||||||
// Print acceleration time
|
|
||||||
@Override
|
@Override
|
||||||
public void showDetails()
|
public void showDetails()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
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;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -14,9 +17,17 @@ public class VehicleInspector {
|
|||||||
|
|
||||||
v.basicInfo();
|
v.basicInfo();
|
||||||
|
|
||||||
// TODO:
|
if (v instanceof ElectricCar)
|
||||||
// If ElectricCar → print "Check battery system"
|
{
|
||||||
// If SportsCar → print "Check brakes and performance"
|
System.out.println("Check battery system");
|
||||||
// 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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user