Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please, i need the main function done. please only do this portion & not just the classes: Demonstrate the classes in a program that has

Please, i need the main function done.

please only do this portion & not just the classes:

Demonstrate the classes in a program that has an array of Ship pointers. Your program will read in a list of Ship, CruiseShip and CargoShip objects from a comma delimited file (see below). The name of that file will be passed in as a command line argument. It will parse each line read and create the appropriate dynamically allocated Ship, cruiseShip or CargoShip objects.

-The program should then sort the array by the name of the ship.

-Then the program should step through the array three times, printing just the ships first, then the CargoShip's, then the CruiseShips.

Here is the whole assignment to help. But i only need the main function done. If you do just the classes that will not be what im asking.

i need:

Demonstrate the classes in a program that has an array of Ship pointers. Your program will read in a list of Ship, CruiseShip and CargoShip objects from a comma delimited file (see below). The name of that file will be passed in as a command line argument. It will parse each line read and create the appropriate dynamically allocated Ship, cruiseShip or CargoShip objects.

-The program should then sort the array by the name of the ship.

-Then the program should step through the array three times, printing just the ships first, then the CargoShip's, then the CruiseShips.

image text in transcribed

!!!!!!!!!!!!!!!!!!!PLEASE COMPLETE IN C++!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!PLEASE COMPLETE IN C++!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!PLEASE COMPLETE IN C++!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!PLEASE COMPLETE IN C++!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!PLEASE COMPLETE IN C++!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!PLEASE COMPLETE IN C++!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!PLEASE COMPLETE IN C++!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!PLEASE COMPLETE IN C++!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!PLEASE COMPLETE IN C++!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!PLEASE COMPLETE IN C++!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Ship, Cruise Ship and CargoShip Classes Design a Ship class 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 (a string) A constructor and appropriate accessors and mutators A virtual print function that displays the ship's name and year it was built. Design a Cruise Ship class that is derived from the Ship class. The Cruise Ship 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 Cruise Ship class's print function should display only the ship's name and the maximum number of passengers Design a CargoShip class that si derived from the 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 accessors and mutators A print function that overrides the print function in the base class. The CargoShip class's print function should display only the ship's name and the ship's cargo capacity. Demonstrate the classes in a program that has an array of Ship pointers. Your program will read in a list of Ship, Cruise Ship and CargoShip objects from a comma delimited file (see below). The name of that file will be passed in as a command line argument. It will parse each line read and create the appropriate dynamically allocated Ship, cruise Ship or CargoShip objects. The program should then sort the array by the name of the ship. Then the program should step through the array three times, printing just the ships first, then the CargoShip's, then the Cruise Ships

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

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions