Menu

[solved]-Write C Program Design Class Named Ship Keeps Following Information Registry Country Ship Q39063787

write a c++ program to Design a class named “Ship” that keepsthe following information:

  • Registry (which country the ship is registered in)
  • Homeport (where the ship normally is when not underway)
  • Name (the ship’s name)
  • Length (in feet)
  • Displacement (in tons. Displacement is a measure of how largethe ship is)

Write a default constructor as well as a constructor that takesall five arguments. Write appropriate accessor and mutatorfunctions for the class.

Next, write a class named “Ferry” that is derived from the”Ship” class. The “Ferry” class should have member variables thathold the following information:

  • Passenger capacity
  • Car capacity
  • Origin (meaning the city in which the ferry normally startsservice)
  • Destination (the city where the ferry travels to)
  • Ticket price

Write a default constructor as well as a constructor that takesall *ten* arguments (five from the Ferry class, and five from theShip class), making sure to properly pass some of those argumentsto the function call for the base class constructor.

Next, write a class named “NavyShip” that is also derived fromthe “Ship” class. The “NavyShip” class should have member variablesholding the following information:

  • Ship type (e.g. destroyer, frigate, battleship,minesweeper)
  • Ship designation (e.g. DD-423)
  • Number of crewmembers
  • If it is nuclear-powered or not
  • Maximum speed

Just as with the “Ferry” class, write a default constructor aswell as a constructor that takes all ten arguments, properlypassing the necessary arguments to a function call to the baseclass constructor.

Demonstrate the classes by writing a program that creates twoarrays: one of Ferry objects and one of NavyShip objects. Have eacharray contain just two objects. Use the data shown below, in theoutput, to populate your object data.

Sample output is below. Meet this minimum level of outputformatting, or improve on it (impress me!). This output also givesyou the data necessary to load into your various objects:

Information for the Ferry Walla Walla: > Registry: US > Homeport: Seattle > Length: 440 > Displacement: 4860 > Passenger Capacity: 2000 > Car Capacity: 188 > Origin: Edmonds > Destination: Kingston > Ticket Price: 35.95Information for the Ferry Samish: > Registry: US > Homeport: Seattle > Length: 362 > Displacement: 4320 > Passenger Capacity: 1500 > Car Capacity: 144 > Origin: Anacortes > Destination: Friday Harbor > Ticket Price: 45.95Information for the Navy Ship USS John McCain: > Registry: US > Homeport: Yokosuka > Length: 505 > Displacement: 8900 > Type: Destroyer > Designation: DDG-56 > Crew: 281 > Nuclear: No > Max Speed: 35Information for the Navy Ship USS Ronald Reagan: > Registry: US > Homeport: Yokosuka > Length: 1092 > Displacement: 101400 > Type: Aircraft Carrier > Designation: CVN-76 > Crew: 3532 > Nuclear: Yes > Max Speed: 40

Expert Answer


Answer to write a c++ program to Design a class named “Ship” that keeps the following information: Registry (which country the shi… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *