Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a Ship class that has the following members: -A memeber variable for the

ID: 3618557 • Letter: D

Question

Design a Ship class that has the following members: -A memeber variable for the name of the ship (a string) -A member variable for the year that the ship was built (astring) -A constructor and appropriate accessors and mutators -A virtual print function that displays the ship's name andthe year it was built. Design a Cruiseship class that is derived from the ship class.The CruiseShip class should have the following members: -A member variable for the maximum number of passengers (anint) -A constructor and appropriate accessors and mutators -A print function that overrides the print function in thebase class. The CruiseShip's print function should display only theship's name and the maximum number of passengers. Design a CargoShip class that is derived from the Ship class.The CargoShip class should have the following members: -A member variable for the cargo capacity in tonnage (anint). -A constructor and appropriate accessors and mutators. -A print function that overrides the print function in thebase classs. The CargoShip class's print function should displayonly the ship's name and the ship's cargo capacity. Demonstrate the classes in a program that has an array of Shippointers. The array elements should be initialized with theaddresses of dynamically allocated Ship, CruiseShip, and CargoShipobjects. (see Program 15-13, lines 17 through 22, for an example ofhow to do this.) The program should then step through the array,calling each object's print function. Design a Ship class that has the following members: -A memeber variable for the name of the ship (a string) -A member variable for the year that the ship was built (astring) -A constructor and appropriate accessors and mutators -A virtual print function that displays the ship's name andthe year it was built. Design a Cruiseship class that is derived from the ship class.The CruiseShip class should have the following members: -A member variable for the maximum number of passengers (anint) -A constructor and appropriate accessors and mutators -A print function that overrides the print function in thebase class. The CruiseShip's print function should display only theship's name and the maximum number of passengers. Design a CargoShip class that is derived from the Ship class.The CargoShip class should have the following members: -A member variable for the cargo capacity in tonnage (anint). -A constructor and appropriate accessors and mutators. -A print function that overrides the print function in thebase classs. The CargoShip class's print function should displayonly the ship's name and the ship's cargo capacity. Demonstrate the classes in a program that has an array of Shippointers. The array elements should be initialized with theaddresses of dynamically allocated Ship, CruiseShip, and CargoShipobjects. (see Program 15-13, lines 17 through 22, for an example ofhow to do this.) The program should then step through the array,calling each object's print function.

Explanation / Answer

please rate - thanks #include #include using namespace std; class Ship {private:     string name;         string built;   public:     Ship(string n, string y)         {name = n;          built = y;         }     string getname()          {return name;           }     string getbuilt()           {returnbuilt;           }     virtual void print()         {cout