Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ need the following completed... Unit 8 - Ship Class Program (20 points) Requirements: Create file ShipClass.h which defines ShipClass that has the following

In C++ need the following completed...

image text in transcribed

image text in transcribed

image text in transcribed

Unit 8 - Ship Class Program (20 points) Requirements: 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 Cruise Ship.h which defines Cruise Ship Class that is derived from Ship Class. The Cruise ShipClass 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 Cruise ShipClass's print function should invoke the ShipClass's print function then display the maximum number of passengers. Create file CargoShip Class.h which defines CargoShip Class that is derived from Ship Class. The CargoShip Class 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 CargoShipClass's print function should invoke the Ship Class's print function then display the ship's 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 Ship Class object 3. Enter values and create a Cruise ShipClass 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 NOTE: No additional functions are needed in the main program. Access the objects through the member functions. Criteria Range - Low End (Did not do or did very little effort) Range - High End (Used correctly and spent time/effort on programming) Correctly named and used variables and objects Used separate .h files for each of the class definitions Correctly coded ShipClass and derived Cruise Ship Class, CargoShip Class Correctly coded the C++ program with a main function that does not define any additional functions Creates an object for each of the classes, inputs data, creates the object, then displays the values for each of the objects using the member print functions. Used comments to document the code and the output is easy to read Turned in the program and screens shots Total Points Possible Sample Output Ship Please Enter Ship Nane: Lollipop Please Enter Year Built: 1945 Ship Information Ship Name: Lollipop Year Built: 1945 Cruise Ship Please Enter Cruise Ship Name: Fantasy Please Enter Year Built: 2004 Please enter maximum passenger capacity: 2300 Cruise ship Information Ship Name: Fantasy Year Built: 2004 Maximum Passengers: 2300 Cargo Ship Please enter Cargo Ship Name: Steamer Please enter Year Built: 1922 Please enter cargo capacity in tonnage: 800 Cruise ship Information Ship Name: Fantasy Year Built: 2004 Maximum Passengers: 2300 Cargo Ship Ship Name : Steamer Year Built: 1922 Cargo Capacity: 800

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

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions