Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create file ShipClass.h which defines ShipClass that has the following members: A member variable for the name of the ship (a string) A member variable

Create file ShipClass.h which defines ShipClass that has the following members:

A member variable for the name of the ship (a string)

A member variable for the year that the ship was built (an int)

A constructor and appropriate set and get functions

A print function that displays the ships name and the year it was built.

Create file CruiseShip.h which defines CruiseShipClass that is derived from ShipClass. The CruiseShipClass should have the following members:

A member variable for the maximum number of passengers (an int)

A constructor and appropriate set and get functions

A print function that overrides the print function in the base class. The CruiseShipClasss print function should invoke the ShipClasss print function then display the maximum number of passengers.

Create file CargoShipClass.h which defines CargoShipClass that is derived from ShipClass. The CargoShipClass should have the following members:

A member variable for the cargo capacity in tonnage (an int).

A constructor and appropriate set and get functions.

A print function that overrides the print function in the base class. The CargoShipClasss print function should invoke the ShipClasss print function then display the ships cargo capacity.

Write a complete program that demonstrates these classes by asking the user to:

1. Enter values and create a ShipClass Object

2. Print the contents of the ShipClass object

3. Enter values and create a CruiseShipClass Object

4. Print the contents of the CrusieShipClass object

5. Enter values and create a CargoShipClass Object

6. Print the contents of the CagoShipClass object

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

At what level(s) was this OD intervention scoped?

Answered: 1 week ago