subject
Engineering, 02.01.2021 06:10 Waakkaa

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.

ansver
Answers: 3

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Ariver flows from north to south at 8 km/h. a boat is to cross this river from west to east at a speed of 20 km/h (speed of the boat with respect to the earth/ground). at what angle (in degrees) must the boat be pointed upstream such that it will proceed directly across the river (hint: find the speed of the boat with respect to water/river)? a 288 b. 21.8 c. 326 d. 30.2
Answers: 3
question
Engineering, 04.07.2019 19:10
The sum of the normal stresses does not change as the stress state rotates through an angle. a)-trune b)- false
Answers: 2
question
Engineering, 04.07.2019 19:10
Which of the following is the most important advantage of a large field of view? a. allows larger areas to be examined b. relieves eyestrain c. minimizes parallax errors. d. increases precision in proportion to the in- crease in field of view
Answers: 2
question
Engineering, 04.07.2019 19:10
Ahelical coil spring has a mean diameter of 50 mm, a wire diameter of 5.5 mm and is wound with a pitch of 10 mm. the spring steel has an ultimate strength of 1250 mpa. find the force needed to compress the spring solid and the wire stress in this condition. state whether the spring will return to its initial length.
Answers: 1
You know the right answer?
Ship, Cruise Ship and CargoShip Classes Design a Ship class that has the following members: • A memb...
Questions
question
Mathematics, 24.04.2020 22:13
question
English, 24.04.2020 22:13
question
English, 24.04.2020 22:13
question
Mathematics, 24.04.2020 22:13
question
Mathematics, 24.04.2020 22:13
Questions on the website: 13722360