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.
Details:
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>