Inheritance Example Ship , CruiseShip, and CargoShip Design a Ship class that ha
ID: 3534585 • Letter: I
Question
Inheritance Example
Ship , CruiseShip, and CargoShip
Design a Ship class that has the following members
Design the CruiseShip class that is derived from the Ship class. The CruiseShip should have the following members.
· A member variable for the maximum number of passengers (an int)
· A constructor that takes three parameters for the ship’s name, year built, and number of passengers and sets ship’s name, year built, and number of passengers at the time of object creation
· Redefine the toString member function that returns the name, year built, and number of passengers (this technique is called the function over riding)
Design the CargoShip class that is derived from the Ship class. The CargoShip should have the following members.
· A member variable for the capacity of the ship (an int)
· A constructor that takes three parameters for the ship’s name, year built, and capacity and sets ship’s name, year built, and capacity at the time of object creation
· Redefine the toString member function that returns the name, year built, and capacity
4.1 Draw the UML diagram that represents the above Inheritance Hierarchy
4.2 Then, implement the Ship, CruiseShip, and CargoShip classes
Explanation / Answer
I am unable to read your code properly. Incase if you are not safisfied with the logic given my friend above. Write me on pratapudaysingh@gmail.com
I know how to make this. Wont take much time. Drop me a mail if you need this to be done. Do mention the problem statement clearly in the mail