Objectives: Design an object-oriented program by creating classes.

Problem: With the Guardians of the Galaxy making Knowhere their base of operations, that sector of space has become rather popular. This popularity brings with it extra traffic and is putting a strain on the intergalactic docking station. Ships are now required to pay for time at the docking station. Those ships that stay longer than their time allotment will receive an automated ticket. You have been hired to write a program that will help generate tickets for parking violations at Knowhere.

Functionality: This program will utilize a linked list as a queue. The ships will dock at the station if there is room and if not the ships will form a queue. Before docking, the ship will pay for time at the docking station. When the ship undocks, the time will be checked to see if the ship stayed longer than the time purchased. If so, a ticket will be generated. When a ship undocks, if there are ships in the queue, the first ship in the queue will dock at the docking station.

Classes:

The members to be included in each class are listed below. All classes should have an overloaded constructor, mutators and accessors. Other functions may be added to the class. Please remember that class functions should be generic enough to be used in any situation. Functions that solve a specific problem for this project should be defined in main rather than the class.

  • Linked List
    • Head (Node pointer)
  • Node
    • Name (string or character pointer)
    • Ship ID (string or character pointer)
    • Credit (in minutes) (integer)
    • Node pointer (to point to next ship in the queue)
  • Meter
    • Hour In (integer)
    • Minutes In (integer)
    • Node pointer (to point to docked ship)
  • Ticket
    • Ship Info (Node or Node pointer)
    • Meter Info (Meter or Meter pointer)
    • Hour Out (integer)
    • Minutes Out (integer)

Details:

  • This project will utilize multiple classes (see above).
  • Each class must have a header file and a source file.
  • The docking station should be an array of Meter pointers
  • There are 10 docks.
  • You may assume that no ship will stay more than 24 hours over their credited time.

Input: All input will come from a file named Knowhere.dat. The file will contain multiple lines of information to describe what is happening at Knowhere. Each line will be one of the formats as described below. You do not need to validate any data. There will be spaces between each item on the line. You may assume that the entries in the file are in chronological order.

Ship entering Knowhere

enter < time in> < ship name> < ship ID> < paid time>

Example

enter 14:15 Milano GG-08-2014 20

Ship leaving Knowhere

exit < ship ID> < time out>

Example

exit GG-08-2014 14:30

For ships entering Knowhere, the time in is only valid if there is a spot available at the docking station. If the docking station has room, the ship will dock at the time specified. If there is no room at the docking station, put the ship in a queue. When a ship leaves the docking station, the first ship in the queue will dock 15 minutes after the ship leaves the docking station.

Output: All output will be written to a file named Tickets.txt. This file will contain all of the tickets generated by ships that stayed at the docking station longer than the amount of time paid. When a ticket is generated, you must calculate the fine (I suggest a function in the ticket class to calculate this). The fine is 2,000 units per extra minute. The ticket should be of the following format:

Ship ID: < Ship ID>
Name: < Ship Name>
Time In: < Hour In>:< Minutes In>
Time Out: < Hour Out>:< Minutes Out>
Credited Minutes: < Credit>
Extra Minutes: < Minutes Over>
Fine: < fine> units
< blank line>
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.