Design the Ship class Include the following items: Name (string) Ship ID (string) Credit (in minutes) (integer)
Fantastic news! We've Found the answer you've been seeking!
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 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
- Include the following items:
- 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
- Include the following items:
- 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
- Create a Ship and a Dock object with the default constructor and the overloaded constructor
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date: