Question
Write a program that simulates a checkout line at an airline ticket counters. A line is a queue object. Passengers (i.e., Passenger objects) arrive in
Write a program that simulates a checkout line at an airline ticket counters. A line is a queue object. Passengers (i.e., Passenger objects) arrive in random integer intervals of from 1 to 5 minutes. Also, each Passenger is serviced in random integer intervals of from 1 to 5 minutes.
Obviously, the rates need to be balanced. If the average arrival rate is larger than the average service rate, the queue will grow infinitely. Even with “balanced” rates, randomness can still cause long lines. Run the Passenger simulation for 720 minutes, using the following algorithm: (Max. of FOUR (4) students)
Requirements: I. Choose a random integer between 1 and 5 to determine the minute at which the first Passenger arrives.
II. At the first Passenger’s arrival time, do the following: a. Determine Passenger’s service time (random integer from 1 to 5). b. Begin servicing the Passenger. c. Scheduled arrival time of next Passenger (random integer 1 to 5 added to the current time).
III. For each minute of the day, consider the following: a. If the next Passenger arrives, proceed as follows: Say so. Enqueue the Passenger. Schedule the arrival time of the next Passenger. b. If service was completed for the last Passenger, do the following: Say so. Dequeue next customer to be serviced. Determine customer’s service completion time (random integer from 1 to 5 added to the current time).
IV. Now run your simulation for 720 minutes and answer each of the following: a) What is the maximum number of Passengers in the queue at any time? b) What is the longest wait anyone Passenger experiences? c) What happens if the arrival interval is changed from 1 to 5 minutes to 1 to 2 minutes?
Step by Step Solution
3.59 Rating (153 Votes )
There are 3 Steps involved in it
Step: 1
include include include genlibh include strlibh include randomh include queueh define SimulationTime 720 define ArrivalProbability 01 define MinServic...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started