Question: Please do in Java Abstract Practice This section briefly covers abstract classes. Vehicle Create a class in the com.day3.practicel package called Vehicle and save it.

 Please do in Java Abstract Practice This section briefly covers abstract

Please do in Java

Abstract Practice This section briefly covers abstract classes. Vehicle Create a class in the com.day3.practicel package called Vehicle and save it. Now add a method as follows: public abstract void move (double distance); Note that Eclipse is indicating that since there is an abstract method, the class must be abstract. This also means that we can no longer create a vehicle as follows: Vehicle vehicle = new Vehicle(); // this doesn't work Make the Vehicle class an abstract class. Spaceship Create a class in the com.day3.practice1 package called Spaceship that extends Vehicle (a Spaceship"IS- A vehicle). Note how Eclipse is telling you that you have to implement the move method. Have the move method display to the console "Spaceship flies x meters." where x is the distance passed in. Hoverboard Create a class in the com.day3.practice1 package called Hoverboard that extends Vehicle (a Hoverboard "IS-A" vehicle). Have the move method display to the console "Moves x meters above the ground." where x is the distance passed in. VehicleDemo Create a class in the com.day3.practicel package called VehicleDemo. Create a Spaceship and have it move 10000 meters and then create a Hoverboard and have it move 50 meters

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!