Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[JAVA] Design a Ship, CargoShip and CruiseShip class being mindful of behavior of each. Demonstrate the classes in a program that has a Ship array.

[JAVA]

Design a Ship, CargoShip and CruiseShip class being mindful of behavior of each. Demonstrate the classes in a program that has a Ship array. Assign various Ships, CruiseShip and CargoShip to the array elements.CargoShip and CruiseShip are a child of Ship class.

Ship -

boolean deck;

int size;

int capacity;

String manufacturer;

String name;

String shiptype

int weight;

Extends Ship

CargoShip

int containercount;

String exhaustport;

int totalcontainerweight;

String typeofCargo;

String cargoshiptype;

CruiseShip

int numberofguests;

int numberofpools;

String nationality;

int numofrestaurants;

int numberofcasino;

Demo polymorphism --> write two or three overridden methods to demonstrate polymorphism.

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

Question

Define Administration and Management

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago