Passengers of Flight CS-344715 to Purell-Wonderland, NY arrive at the airport 3 hours before departure (use sleep(random_time) to simulate arrival). Upon their arrival, they go straight to the check-in kiosk to print their boarding passes.
Unfortunately, due to budget cuts, the airline can only maintain two checking counters at this time. To avoid crowding around the highly sought-after checking counters, the airline asks passengers to form lines of no more than a few passengers at each counter (determined by counterNum) Each passenger must block on a different object. Use a similar approach as the one in rwcv.java. Those not able to get on a line for a counter are asked to stand by (wait). To ensure fairness to those that arrived early, passengers should be helped in the order in which they arrived (ensure FCFS among passengers).
At each checking counter, there is a checking counter-clerk who will assist the passengers. While assisted, the passengers receive their boarding pass with their seat and zone number printed on it. Note that the aircraft holds only 30 passengers and is split up in 3 zones. Passengers are assigned a random seat number between 1-30 and a corresponding zone number; passengers with seat numbers between 1 and 10 passengers are in Zone 1, passengers with seat numbers between 11 and 20 are in Zone 2, etc. The number is generated by the clerk and assigned to the passenger. (Output a message to the screen with the passenger’s seat and zone information).
Once the passenger arrives at the gate, they take a seat and wait for the flight attendant to call for passengers to board (passengers belonging to the same zone will all block on the same object. So there will be 3 different objects for 3 different zones)
A half an hour before the plane departs, the flight attendant begins to call passengers up to the door of the jet bridge. The flight attendant calls the zones one by one.
For example, when it comes to zone 1, the flight attendant calls all passengers of zone 1 (use notifyAll) and asks the passengers to scan their boarding pass and get to the airplane’s door. This must be done in a mutual exclusion way. Use synchronized methods. When all have arrived, the passengers enter the plane in groups (determined by groupNum), so that passengers can comfortably stow their belongings and take their seats. You don’t necessarily need to use separate notifications objects, rather use a variable that will be updated. When that variable becomes groupNum, allow first the passengers part of that group to arrange their luggage and take a seat, and next a new groupNum of passengers will be able to get inside the plane.
The flight attendant calls each of the remaining zones the same way.
After all zones have boarded, the flight attendant makes an announcement indicating that the door of the plane has closed. All passengers that arrive at the gate after this announcement are asked to rebook their flight and return home (these threads
terminate). All other passengers get entertained on the flight in transit to their destination (use wait).
Two hours pass, and the plane prepares for landing. The flight attendant notifies the passengers with an announcement over the loud speaker.
The plane lands and the passengers wait for the go-ahead to disembark the plane. When the flight attendant turns off the seatbelt light, passengers are asked (notified) to leave the plane in ascending order of their seat number (let’s say on the plane you have Thread- 3 (seat 2), Thread-4 (seat 3), Thread-2 (seat 4) and Thread-1 (seat 1); Make sure that the passengers are notified in the specified order.
The passengers disperse after the flight and go off to their respective destinations (threads terminate). The flight attendant cleans the aircraft, and is the last to leave after all the passengers(thread terminates). The last passenger to leave will notify the flight attendant.