Question: [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

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!