CPT 244 Customer Processing Problem | Assignment

Added on - 18 Sep 2019

Trusted by 2+ million users,
1000+ happy students everyday
Showing pages 1 to 2 of 4 pages
CPT 244 – Queues: Customer ProcessingProblemWhen we are waiting in a fast food line, an airline service counter, a bank, etc. there is typicallyone of two different methods of managing customers:Have a single line for people waiting for service. Every customer waits in a single line.When a teller becomes free, the customer at the head of the line moves to the teller. Ifthere are multiple tellers free, one is picked randomly.Have multiple lines – one for each teller. When customers come in the door they attemptto pick the line that has the shortest wait. This usually involves standing in the line withthe fewest customers. If there are multiple choices, the appropriate line is selectedrandomly.So, which of these two methods of queuing customers is most efficient? In the single-linetechnique, tellers appear to be constantly busy and no customer is served before any customerthat arrives later. In the multiple-line technique, however, customers can take the responsibilityof evaluating the lines themselves.ProcedureAttached to this assignment in the drop box are three files. One models a Customer, one modelsa customer generator (e.g. the front door of a bank) and the final models the bank itself (whichcontains the Main method). The Main method is really just a shell to demonstrate calling thecustomer generator. The generator accepts the following arguments:minDuration – The minimum amount of time that it will take to process a customer'srequest.maxDuration – The maximum amount of time that it will take to process a customer'srequest.avgPerSlot – The average number of customers that will arrive per time slot. (e.g. .5would mean one customer every two minutes; 3 would mean three customers per minute)totalTime – Total number of time slots for which customers are to be generated. Forexample, 120 means a two hour timeslot. The time will actually be slightly longer toservice the last few customers.seed – If present, the this value is passed as the seed to the random number generator. Ifthe seed is negative, no seed is passed.For the sake of this program, all time units represent one minute, though as long as the unit isconsistent throughout the program, this could be any time (second, millisecond, day, etc.) Theclass has a single method, GetCustomers, which returns a Queue of customers now waiting to beserved. You could think of it as the all the customers who arrived in the last minute. Thatmethod takes a single argument, timeslot, which is the number of seconds that have elapsed
during the simulation. The precise working of the CustomerGenerator isn't important for theassignment, but if you are curious you have the code.For this assignment you will not need to create a Customer since the CustomerGenerator will dothat, but you will need to access its properties. Two of these are set when the Customer iscreated and cannot be modified. You will want to set the service time when the Customeractually reaches teller.Begin your assignment using these three files.For a grade of 'C':We want to know how many tellers it takes so that no customer ever has to wait more than fiveminutes in line before being waited on. To get at this, and some other information our employerwants, we want to display the maximum minutes a teller was idle, the average minutes a tellerwas idle, the maximum minutes a customer had to wait and the average minutes a customer hadto wait. (These last two need to be calculated on the fly, we aren't going to make all thecustomers wait in line until the day is over and ask them how long they waited.)You are going to need a Teller class. At a minimum, the Teller class should keep track of howmuch time it spends in the idle state, i.e. w/o having an active customer. It must also have someway to process a customer. To make things easier, I also suggest that the Teller have a referenceto a Queue of customers so that it can pull the next customer off the queue. That will makemoving to the work for a ‘B’ easier as well. I also encourage you to have a reference to thecurrentCustomer. You will also want a processNextCustomer method – see below.I'll leave most of the details up to you, but here is a very high level view of your process.Create an empty Queue of customersCreate a CustomerGenerator.Create a list of Tellers – start with some reasonable size, then modify the number untilyou have the fewest number of tellers but still have no wait time greater than fiveminutes. Note your code does not have to do figure this out; you can experiment untilyou find the right answer. Think carefully and you should be able to determine a goodstarting point based on the parameters passed to the CustomerGenerator constructor.Set the currentMinute to zero.Loopuntil the time duration expires AND the Queue is empty, performing the followingoget the list of customers from the customer generator for that minuteoadd them to the Queue of customersoforeachteller in the listhave the teller process a customer (processNextCustomer)the method should accept the current time as its argumentit should check to see whether it is still busy (Question: how does it knowwhether it is busy?) with an earlier customer; there are three possibilitiesobusyoreturn w/o doing anything
Desklib Logo
You are reading a preview
Upload your documents to download or

Become a Desklib member to get access