Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following code and answer the following question / / Interface interface Engine { void start ( ) ; void stop ( ) ;
Consider the following code and answer the following question
Interface
interface Engine
void start;
void stop;
abstract class Vehicle
private Engine engine;
public VehicleEngine engine
this.engine engine;
public void startEngine
engine.start;
public void stopEngine
engine.stop;
Other common vehicle methods
class Car extends Vehicle
private String model;
public CarString model, Engine engine
superengine;
this.model model;
Carspecific methods
class Bike extends Vehicle
private String type;
public BikeString type, Engine engine
superengine;
this.type type;
Bikespecific methods
interface ElectricVehicle extends Engine
void charge;
class ElectricCar extends Car implements ElectricVehicle
public ElectricCarString model
supermodel null; Engine can be null for electric cars
@Override
public void charge
Charging logic for electric cars
Which one of the following answers are incorrect Please check all that apply:
a
A composition relationship exists between Car and Vehicle
b
ElectricVehicle is a subclass of Engine
c
Engine is a subclass of Vehicle
d
Class Vehicle realizes the interface Engine
e
ElectricVehicle is realized by ElectricCar
f
Bike is a subclass of Engine
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started