Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions: Using Java code please do the following and answer all questions 1-4. Thanks You are give the following interface Movable(): public interface Movable {

Instructions: Using Java code please do the following and answer all questions 1-4. Thanks

You are give the following interface Movable():

public interface Movable {

public void moveForward();

public void moveBackward();

public void stop();

public void moveLeft();

public void moveRight();

}

Base on the Movable interface create three classes: Car(), Plane(), and Ship() that implement it. After that, create a program that will polymorphically process an array of Movable by calling each of the interface methods, after creating an object for each one of the classes. Implement the classes in such a way that the output is:

Plane flying forward

Plane taxiing backward

Plane landed

Plane flying left

Plane flying right

---------------------

Car drives forward

Car drives backward

Car parked

Car turns left

Car turns right

---------------------

Ship navigates forward

Ship navigates backward

Ship docked

Ship navigates left

Ship navigates right

---------------------

Lab Report:

On your OpenLab portfolio create a new page and post the following items:

Description of the lab in your own words.

Source Code.

Screenshots of you program running and results.

Write comments in your source code.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions