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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started