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, 03.07.2019 15:10
Heat is added to a piston-cylinder device filled with 2 kg of air to raise its temperature 400 c from an initial temperature of t1 27 cand pressure of pi 1 mpa. the process is isobaric process. find a)-the final pressure p2 b)-the heat transfer to the air.
Answers: 1
question
Engineering, 04.07.2019 18:10
During a steady flow process, the change of energy with respect to time is zero. a)- true b)- false
Answers: 2
question
Engineering, 04.07.2019 18:10
Shafts are machine elements that are used to a) carry axial loads b) direct shear loads c) transmit power d) rotate at constant speed e) none of the above circular and square shafts subjected to the same torque under the same circum behave a) the same way b) almost the same way
Answers: 2
question
Engineering, 04.07.2019 18:10
Which one from below is not one of the reasons of planning failures? (clo3) a)-planner is careless. b-planner spend less time in the field but more time on the desk c)-planner is not qualified d)-planner does not have sufficient time to properly plan
Answers: 3
You know the right answer?
Ship, Cruise Ship and CargoShip Classes Design a Ship class that has the following members: • A memb...
Questions