Consider the following classes public abstract class Vehicle { public boolean st
ID: 3552426 • Letter: C
Question
Consider the following classes
public abstract class Vehicle {
public boolean startEngine() {/* code */ }
public abstract int getMaxSpeed();
public abstract double getVehicleValue();
}
public interface Rentable {
public double getWeeklyRate();
}
public interface UsesPremiumGas {
public void fillTankWithPremiumGas(double gallons);
}
public class Car extends Vehicle implements Rentable {/*code*/}
public class FancyCar extends Car implements UsesPremiumGas
{ /* code */ }
public class Bus extends Vehicle { /* code */ }
Answer the following questions (must means so that the code compiles).
a) Which methods must be implemented in the Car class?
b) Which methods must be implemented in the FancyCar class?
c) Which methods must be implemented in the Bus class?
Explanation / Answer
<<a>>
public int getMaxSpeed()
public double getVehicleValue()
public double getWeeklyRate()
--------------------------------------------------------------------------------------------------
<<b>>
public void fillTankWithPremiumGas(double gallons)
--------------------------------------------------------------------------------------------------
<<c>>
public int getMaxSpeed()
public double getVehicleValue()
--------------------------------------------------------------------------------------------------
<<d>>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.