1. You are to implement three classes for this coursework that will be used to simulate passengers queuing at a boarding gate and boarding an airplane. The three classes and their important fields and methods are described in the Class diagram below. You may include additional fields and methods as required to complete the solution.

Passenger. This class will contain the properties of a passenger relevant to our simulation.
Fields - firstName:String, surname:String, secondsInQueue:int
Methods - getters and setters (see class diagram).

PassengerQueue. This class will represent the queue at the boarding gate.
Fields queueArray: Array of Passenger, first:int, last:int, maxStayInQueue:int
Methods: add(), remove(), display(), getMaxStay(), isEmpty(), isFull().

Airport: This is the main class that will drive the program.
Fields: passengers: Array of Passenger, queue1: PassengerQueue
Methods: main() and the other methods you implement from the menu.

Class Diagram: see image.

In a similar way to coursework 1, you should create a menu system in the main() method of your Airport class which allows the user to choose which operation they want the program to do. Each operation should be implemented as a separate method and the menu should allow the following operations:

'A' to add a passenger to the passengerQueue, and a V to view the passengerQueue.
D: Delete passenger from the passengerQueue,
S: Store passengerQueue data into a plain text file,
L: Load passengerQueue data back from the file into the passengerQueue
R : Run the simulation and produce report (see details below).

Queue Details

Create your own queue object in your program and write your own methods within the object to add to queue and take from queue. Every time a passenger is added to a passengerQueue it should prompt for passenger details, then use the queue objects method to add the passenger to the queue. When the user selects to view, the details of all passengers currently in the queue should be displayed. The queue should be based on an array and hold 20 Passengers. When the queue items reach the end of the array they should be added to the start of the array (circular queue). If the queue becomes full then an error message should be displayed. Note: Your solution should be a console application (not windows), and must be implemented by you based on lecture notes.

'R' - running the simulation details.

You have been given a passenger list with passenger names (passengers.dat). The pseudocode for this portion is as follows:

Read in the passenger file into the passengers array.
Repeat until the passenger queue is empty
__Randomly generate a number of arrivers using 1 six sided die (as per your workshop). This will represent how many passengers join the queue.
__Add that number of passengers from the passengerArray into the passengerQueue.
__Randomly generate a processing delay using 3 six sided dice (as per your workshop).
__This will represent how many seconds it takes to check the boarding ticket and let the next passenger board the plane.
__Add the processing delay to each passenger already in the queue.
__Remove the next passenger from the queue.
__Gather waiting times and other statistics (length, max/min waiting time...)
End repeat.
Produce a report and output to the screen, and also output to a file called ‘report.dat’.

The report should display the details of the passengers from passengerArray and then print a summary of the maximum length of the queue attained, the maximum waiting time, the minimum waiting time, and the average waiting time of all the passengers.

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.