Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

12, saap, Cruiseship, and cargo ip Classes Design a Ship class that has the following members Amember variable for the name of the ship (a

image text in transcribed
12, saap, Cruiseship, and cargo ip Classes Design a Ship class that has the following members Amember variable for the name of the ship (a string) member variable for the year that the ship was buile (a string) - A constructor and appropriate accessors and 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 Cruseship class should have the following members - A member variable for the maximum number of passengers (an int) . A constructor and appropriate accessors and mutators . A print function that overrides the print function in the base class. The Cruiseship class's print function should display only the ship's name and the maximum number of passengers Design a cargosnip 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 (an intl. . A constructor and appropriate accessors and mutators. . A print function that overrides the print function in the hase class. The Cargoship dlass's print function should display only the ship's name and the ship's cargo capacity 15 Inheritance, Polymorphism, and virtual Functions that has an array of ship pointers. The array Demonstrate the classes in a program elements should be initialized with the addresses of dynamically allocated ship, Cruiseship, and Cargoship objects. See Program 15-14, lines 17 through 22. for an example of how to do thisi The program should then step through the array, calling each object's print function. Ship name: Lolliepop Year built: 1933 Ship's name: Love Boat Max passengers: 3512 Ship's name: Florida Cargo capacity: 50000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

LO1 Understand risk management and identify its components.

Answered: 1 week ago