Question: Use JAVA 1. Create an interface called Manual that has two methods, gearUp and gearDown, which does not take any argument. They both return void.

Use JAVA 1. Create an interface called Manual that has two methods, gearUp and gearDown, which does not take any argument. They both return void.

2. Then one abstract class called Vehicle, which we will use to create two subclasses: Car and Bicycle.

3. All vehicle should have a current gear (int) and a registration number (String) but only Car have a license plate (String). All cars have 5 speed (from 1 to 5) and all bicycles have 18 speed (from 1 to 18). You also need an int constant (MAX_GEAR) that indicate the maximum gear.

4. Create an initializer constructor for every class to initialize their data member(s). [hint: you should have 3 and only 3 constructors in total]

5. Implement gearUp and gearDown for both Car and Bicycle. Simply increase current gear if it has not reach the largest possible gear; otherwise, does nothing. gearDown should decrease current gear if it is greater than 1; otherwise, does nothing.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!