Question: Design the Ship class Include the following items: Name (string) Ship ID (string) Credit (in minutes) (integer) Ship pointer (to point to next ship in

  • Design the Ship class
    • Include the following items:
      • Name (string)
      • Ship ID (string)
      • Credit (in minutes) (integer)
      • Ship pointer (to point to next ship in the queue)
      • Accessors for each variable
      • Mutators for each variable
      • A default constructor that initializes all variables to zero or null
      • An overloaded constructor that assigns the values passed in to name, ship ID and credit
      • Define both constructors in the source file
  • Design the Dock class
    • Include the following items:
      • Hour In (integer)
      • Minutes In (integer)
      • Ship pointer (to point to docked ship)
      • Accessors for each variable
      • Mutators for each variable
      • A default constructor that initializes all variables to zero or null
      • An overloaded constructor that assigns the values passed in to hours in and minutes in
      • Define both constructors in the source file
  • Create a driver program to test the classes
    • Create a Ship and a Dock object with the default constructor and the overloaded constructor
      • Use the mutators to change the values in the objects created by the default constructor
    • Assign one of the Ships to the Ship pointer in the other Ship object
    • Assign one of the ships to the Ship pointer in one of the Dock objects
    • Print the contents of one of the Ship objects using accessors
    • Print the contents of one of the Dock objects using accessors
    • Print the contents of the Ship that is connected by the Ship pointer in one of the Dock objects.
      • You must use the Dock object and the Ship pointer inside the Dock object to refer to the Ship

Step by Step Solution

3.48 Rating (171 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Note there are minor changes in the Dockh and Dockcpp as u have assumed shipAssigned in dock object ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!