Question: can someone write this code in C++ that works on xcode!! Design a ship class that has the following members: Amernber variable for the name
Design a ship class that has the following members: Amernber variable for the name of the ship A member variable for the year that the ship was built A constructor and appropriate getter and setter functions (accessor/mutators) A virtual print function that displays the ship's name and the year it was built. Design a Cruiseship class that is derived from the ship class. The CrailseShip class should have the following members: . A member variable for the maximum number of passengers A constructor and appropriate getter and setter functions . A print function that overrides the print function in the base class. The Cruiseship class' print function should display only the ship'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 A constructor and appropriate getter and setter functions A print function that overrides the print function in the base class. The CargoShip class' print function should display only the ship's name and the ship's cargo capacity Write a program that has an array of Ship pointers. The array elements should be initialized with the addresses of dynamically allocated Ship) Cruiseship and Carga Ship objects (use the new keyword with the constructor which returns a pointer to the new object). The program should then step through the array and call each object's print function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
