Question: 4. Consider the following interface Vehicle. Interface Vehicle { void changeGear(char newGear); void increaseSpeed(int newSpeed); void decreaseSpeed(int newSpeed); a) Create the classes Car and Bus

4. Consider the following interface Vehicle. Interface Vehicle \{ void changeGear(char newGear); void increaseSpeed(int newSpeed); void decreaseSpeed(int newSpeed); a) Create the classes Car and Bus that implements the methods of interface Vehicle. b) Add gear and speed fields in Car and Bus classes. c) changeGear() method sets the gear field by newGear value. d) increaseSpeed() method increases the speed field by newSpeed value. e) decreaseSpeed() method decreases the speed field by newSpeed value
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
