completed your work by the deadline. After the finance hold is lifted you must then submit the same work as normal on Blackboard,
otherwise it will not be marked and you will get a fail for that part of the assessment.
Airport Program - Coursework and In-Class Test
You are to be assessed on how well you know Classes, objects, and data structures (queues). Most
of the marks will come from your in-class test result. Concentrate on understanding the main code,
and then getting additional program extras to work.
Airport Program.
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 queueA
ay: A
ay 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: A
ay of Passenger, queue1: PassengerQueue
Methods: main() and the other methods you implement from the menu.
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 cu
ently in the queue should be
displayed. The queue should be based on an a
ay and hold 20 Passengers. When the queue items
each the end of the a
ay they should be added to the start of the a
ay (circular queue). If the
queue becomes full then an e
or 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 a
ay.
Repeat until the passenger queue is empty
Randomly generate a number of a
ivers 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 passengerA
ay 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 passengerA
ay 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.
For an additional challenge you can create two queues and have each passenger join the shortest
queue. Compare the different summary statistics with the single queue implementation. (You can
eceive an extra 5% for this that may only be used to offset lost marks).
Submission Instructions:
Java Program code to be submitted as a single text file by the date shown above on Blackboard
4COSC005 ‘Submit Coursework’ link. For this submission you should copy and paste all classes into
ONE long text file, type the filename at the top of each piece of pasted code, and at the very top of
the text file type your name and your student id. Call this large saved file by your ID number (e.g. .
w123456.txt ) and ensure it is saved as plain text. Do not change your code after it has been
submitted.
Tutorial in-class test.
There will be a short in-class test in the theory tutorial session following the submission of the
coursework. We need to know that you fully understand the code you use, and have not just
stumbled on a solution, or copied it from elsewhere. For the test you will be assessed on how well
you know classes, data structures, a
ays, a
ay manipulation code, and methods, so look at the
examples in the notes as well as understanding your Airport program.
Do not attempt to go to the wrong tutorial group without the tutor’s permission. If you miss the test
there will be no other opportunity to redo the work in a later week unless you have approved
mitigating circumstances. Sign-in on the class list during the test.
Marking Criteria
80% of the marks will come from the in-class test result. If you score 4/15 or less in the in-class test
then your code solution mark will be limited to a maximum of 50% as the test will have proved you
did not really understand the code.
20% of the marks will come from your ‘Airport’ code solution.
Code marking:
40% A basic solution with menu options A, V, D implemented as methods.
+20% Options S and L working.
+30% Simulation and report. Option R.
+10% Demonstration and completed self-assessment form.
Warning: All code must be done by yourself to ensure you can answer questions during the
demonstration. You may be capped at 50% if you cannot explain the code.
Pass grade: A basic code solution and 40% in the in-class test.
Distinction grade (>=70%).