Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need a C program to answer the following problem 22. Using the C ADT, write a program that simulates the operation of a tele-
I need a C program to answer the following problem
22. Using the C ADT, write a program that simulates the operation of a tele- phone system that might be found in a small business, such as your local pizza parlor. Only one person can answer the phone (a single-server queue), but there can be an unlimited number of calls waiting to be answered Queue analysis considers two primary elements, the length of time a requester waits for service (the queue wait time-in this case, the cus- tomer calling for pizza) and the service time (the ime takes the cus- tomer to place the order). Your program should simulate the operation of the telephone and gather statistics during the process. The program requires two inputs to run the simulation: (1) the length of time in hours that the service is provided and (2) the maximum time it takes for the operator to take an order (the maximum service time) Four elements are required to run the simulation: a timing loop, a call simulator, a call processor, and a start call function. a. Timing loop: This is simply the simulation loop. Every iteration of the loop is considered 1 minute in real time. The loop continues until the service has been in operation the requested amount of time (see input above). When the operating period is complete, however, any waiting calls must be answered before ending the simulation. The timing loop has the fol lowing subfunctions Determine whether a call was received (call simulator) Process active call Start new call This sequence allows a call to be completed and another call to be started in the same minute b. Call simulator: The call simulator uses a random-number generator to deter- mine whether a call has been received. Scale the random number to an appropriate range, such as 1 to 10 The random number should be compared with a defined constant. If the value is less than the constant, a call was received; if is not, no call was received. For the simulation set the call level to 50%, that is, on the average, a call is received every 2 minutes. If a call is received, place it in a queue 22. Using the C ADT, write a program that simulates the operation of a tele- phone system that might be found in a small business, such as your local pizza parlor. Only one person can answer the phone (a single-server queue), but there can be an unlimited number of calls waiting to be answered Queue analysis considers two primary elements, the length of time a requester waits for service (the queue wait time-in this case, the cus- tomer calling for pizza) and the service time (the ime takes the cus- tomer to place the order). Your program should simulate the operation of the telephone and gather statistics during the process. The program requires two inputs to run the simulation: (1) the length of time in hours that the service is provided and (2) the maximum time it takes for the operator to take an order (the maximum service time) Four elements are required to run the simulation: a timing loop, a call simulator, a call processor, and a start call function. a. Timing loop: This is simply the simulation loop. Every iteration of the loop is considered 1 minute in real time. The loop continues until the service has been in operation the requested amount of time (see input above). When the operating period is complete, however, any waiting calls must be answered before ending the simulation. The timing loop has the fol lowing subfunctions Determine whether a call was received (call simulator) Process active call Start new call This sequence allows a call to be completed and another call to be started in the same minute b. Call simulator: The call simulator uses a random-number generator to deter- mine whether a call has been received. Scale the random number to an appropriate range, such as 1 to 10 The random number should be compared with a defined constant. If the value is less than the constant, a call was received; if is not, no call was received. For the simulation set the call level to 50%, that is, on the average, a call is received every 2 minutes. If a call is received, place it in a queueStep by Step Solution
There are 3 Steps involved in it
Step: 1
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