[Solved]-Python Program Design Ship Class Following Members Member Variable Name Ship Member Variab Q37162262
Python Program —- Design a Ship class that has the followingmembers: • A member variable for the name of the ship • A membervariable for the year that the ship was built • A constructor andappropriate accessors and mutators • A print function that displaysthe ship’s name and the year it was built. Design a CruiseShipclass that is derived from the Ship class. The CruiseShip classshould have the following members: • A member variable for themaximum number of passengers • A constructor and appropriateaccessors and mutators • A print function that overrides the printfunction in the base class. The CruiseShip class’s print functionshould display only the ship’s name and the maximum number ofpassengers. Design a CargoShip class that is derived from the Shipclass. The CargoShip class should have the following members: • Amember variable for the cargo capacity in tonnage. • A constructorand appropriate accessors and mutators. • A print function thatoverrides the print function in the base class. The CargoShipclass’s print function should display only the ship’s name and theship’s cargo capacity. Demonstrate the classes in a program thathas a list of Ships. The list elements should be initialized withShip, CruiseShip, and CargoShip objects. The program should thenstep through the list, calling each object’s print function. Usethe Python issinstance() function to determine which object typeeach element holds.
Expert Answer
Answer to Python Program —- Design a Ship class that has the following members: • A member variable for the name of the ship �… . . .
OR

