Question: Consider the following interface Vehicle. interface Vehicle { void changeGear(char newGear); void increaseSpeed(int newSpeed); void decreaseSpeed(int newSpeed); } Create the classes Car and Bus that
Consider the following interface Vehicle.
interface Vehicle
{
void changeGear(char newGear);
void increaseSpeed(int newSpeed);
void decreaseSpeed(int newSpeed);
}
Create the classes Car and Bus that implements the methods of interface Vehicle.
Add gear and speed fields in Car and Bus classes.
changeGear() method sets the gear field by newGear value.
increaseSpeed() method increases the speed field by newSpeed value.
decreaseSpeed() method decreases the speed field by newSpeed value.
I want the solution to be in java bluej
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
