CALL CENTER SIMULATION Write a C++ program to simulate a Call Center. A call center...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
CALL CENTER SIMULATION Write a C++ program to simulate a Call Center. • A call center handles incoming telephone calls. • Atelephone call is represented by a unique Caller ID (identification) number (integer). • The call center has a limited number of service queues. The built-in C++ Standard Template Library (STL) will be used for queue operations. The number of elements (size) of a queue can be unlimited. • An incoming telephone call will be added to a randomly selected queue. This is done by pushing a Caller ID number to the selected queue. Deleting a finished telephone call will be done from a randomly selected queue. This is done by poping a Caller ID number from the selected queue. The followings are the simulation parameters that should be defined in your program: #define N 2 // Number of simulation cycles #define K 3 // Number of queues #define IC 8 // Number of incoming calls per cycle (Number of ADD operations in a cycle) #define FC 4 // Number of finished calls per cycle (Number of DELETE operations in a cycle) The simulation should be performed in N cycles (i.e. main loop iterations). ALGORITHM (OUTLINE) Initialize the Caller ID variable with 1. In a loop (simulation cycles) from 1 to N, do the followings: In a loop from 1 to IC, do the followings: Randomly select a queue. Add (push) a Caller ID to the selected queue. Display a message about the add operation on screen. • Increment the Caller ID variable by 1. In a loop from 1 to FC, do the followings: Randomly select a queue. Get a Caller ID from the selected queue, if that queue is not empty. Delete (pop) the Caller ID from the selected queue. Display a message about the delete operation on screen. By using nested loops, remove all of the remaining phone calls from queues, and display messages about the delete operations on screen. (Note: There is no randomness in this section of program.) EXAMPLE SCREEN OUTPUT (User will not enter any data from the keyboard.) Cycles of Call Center Simulation are started. Simulation Cycle no = 1 ADD operation : Caller ID= 1, Selected Queue= 2 ADD operation : Caller ID= 2, Selected Queue= 2 ADD operation : Caller ID= 3, Selected Queue= 1 ADD operation : Caller ID= 4, Selected Queue= 1 ADD operation : Caller ID= 5, Selected Queue= 1 ADD operation : Caller ID= 6, Selected Queue= 2 ADD operation : Caller ID= 7, Selected Queue= 0 ADD operation : Caller ID= 8, Selected Queue= 1 DELETE operation : Caller ID= 1, Selected Queue= 2 DELETE operation : Caller ID= 7, Selected Queue= 0 DELETE operation : Caller ID= 2, Selected Queue= 2 DELETE operation : Caller ID= 3, Selected Queue= 1 Simulation Cycle no = 2 ADD operation : Caller ID= 9, Selected Queue= 0 ADD operation : Caller ID= 10, Selected Queue= 1 ADD operation : Caller ID= 11, Selected Queue= 2 ADD operation : Caller ID= 12, Selected Queue= 0 ADD operation : Caller ID= 13, Selected Queue= 1 ADD operation : Caller ID= 14 , Selected Queue= 0 ADD operation : Caller ID= 15 , Selected Queue= 0 ADD operation : Caller ID= 16 , Selected Queue= 0 DELETE operation : Caller ID= 9, Selected Queue= 0 DELETE operation : Caller ID= 12, Selected Queue= 0 DELETE operation : Caller ID= 6, Selected Queue= 2 DELETE operation : Caller ID= 14, Selected Queue= 0 Cycles are ended. Removing all of the remaining calls from queues : DELETE operation : Caller ID= 15, Queue= 0 DELETE operation : Caller ID= 16 , Queue= 0 DELETE operation : Caller ID= 4, Queue= 1 DELETE operation : Caller ID= 5, Queue= 1 DELETE operation : Caller ID= 8, Queue= 1 DELETE operation : Caller ID= 10, Queue= 1 DELETE operation : Caller ID= 13, Queue= 1 DELETE operation : Caller ID= 11, Queue= 2 Program is ended. EXAMPLE PROGRAM The following is an example C++ program illustrating : how to define an array of STL queues, • how to add a Caller ID number to a randomly selected queue, and how to delete a Caller ID number from a randomly selected queue. // Filename: example.cpp #include <stdio.h> // For printf function #include <stdlib.h> // For srand and rand functions #include <time.h> // For time function #include <queue> // For STL queue class using namespace std; // C++ requirement int main() { queue <int> Q[3]; I/ Array of STL queues (3 queues), which will store caller ID numbers int selected_queue; // Index of a randomly selected queue int caller_ID = 1; int tmp_caller_ID; // Temporary caller ID // Caller ID number srand(time(NULL)); // Seed (initialize) the random number generator /-- selected_queue = rand() % 3; Q[selected_queue).push(caller_ID); // Add a caller ID number to the selected queue printf("ADD operation : Caller ID= %d, Selected Queue= %d \n", caller_ID, selected_queue); // Randomly determine the index number of a queue %3D selected_queue = rand() % 3; if (! Q[selected_queue).empty()) { tmp_caller_ID = Q[selected_queue].front(); // Get (without deleting) a caller ID from selected queue Q[selected_queue].pop(); printf("DELETE operation : Caller ID= %d, Selected Queue= %d \n", tmp_caller_ID, selected_queue); // Randomly determine the index number of a queue // Check if the queue is not empty // Delete a caller ID from the selected queue else printf("DELETE operation : Selected Queue= %d (Queue is empty) \n", selected_queue); }// End of main CALL CENTER SIMULATION Write a C++ program to simulate a Call Center. • A call center handles incoming telephone calls. • Atelephone call is represented by a unique Caller ID (identification) number (integer). • The call center has a limited number of service queues. The built-in C++ Standard Template Library (STL) will be used for queue operations. The number of elements (size) of a queue can be unlimited. • An incoming telephone call will be added to a randomly selected queue. This is done by pushing a Caller ID number to the selected queue. Deleting a finished telephone call will be done from a randomly selected queue. This is done by poping a Caller ID number from the selected queue. The followings are the simulation parameters that should be defined in your program: #define N 2 // Number of simulation cycles #define K 3 // Number of queues #define IC 8 // Number of incoming calls per cycle (Number of ADD operations in a cycle) #define FC 4 // Number of finished calls per cycle (Number of DELETE operations in a cycle) The simulation should be performed in N cycles (i.e. main loop iterations). ALGORITHM (OUTLINE) Initialize the Caller ID variable with 1. In a loop (simulation cycles) from 1 to N, do the followings: In a loop from 1 to IC, do the followings: Randomly select a queue. Add (push) a Caller ID to the selected queue. Display a message about the add operation on screen. • Increment the Caller ID variable by 1. In a loop from 1 to FC, do the followings: Randomly select a queue. Get a Caller ID from the selected queue, if that queue is not empty. Delete (pop) the Caller ID from the selected queue. Display a message about the delete operation on screen. By using nested loops, remove all of the remaining phone calls from queues, and display messages about the delete operations on screen. (Note: There is no randomness in this section of program.) EXAMPLE SCREEN OUTPUT (User will not enter any data from the keyboard.) Cycles of Call Center Simulation are started. Simulation Cycle no = 1 ADD operation : Caller ID= 1, Selected Queue= 2 ADD operation : Caller ID= 2, Selected Queue= 2 ADD operation : Caller ID= 3, Selected Queue= 1 ADD operation : Caller ID= 4, Selected Queue= 1 ADD operation : Caller ID= 5, Selected Queue= 1 ADD operation : Caller ID= 6, Selected Queue= 2 ADD operation : Caller ID= 7, Selected Queue= 0 ADD operation : Caller ID= 8, Selected Queue= 1 DELETE operation : Caller ID= 1, Selected Queue= 2 DELETE operation : Caller ID= 7, Selected Queue= 0 DELETE operation : Caller ID= 2, Selected Queue= 2 DELETE operation : Caller ID= 3, Selected Queue= 1 Simulation Cycle no = 2 ADD operation : Caller ID= 9, Selected Queue= 0 ADD operation : Caller ID= 10, Selected Queue= 1 ADD operation : Caller ID= 11, Selected Queue= 2 ADD operation : Caller ID= 12, Selected Queue= 0 ADD operation : Caller ID= 13, Selected Queue= 1 ADD operation : Caller ID= 14 , Selected Queue= 0 ADD operation : Caller ID= 15 , Selected Queue= 0 ADD operation : Caller ID= 16 , Selected Queue= 0 DELETE operation : Caller ID= 9, Selected Queue= 0 DELETE operation : Caller ID= 12, Selected Queue= 0 DELETE operation : Caller ID= 6, Selected Queue= 2 DELETE operation : Caller ID= 14, Selected Queue= 0 Cycles are ended. Removing all of the remaining calls from queues : DELETE operation : Caller ID= 15, Queue= 0 DELETE operation : Caller ID= 16 , Queue= 0 DELETE operation : Caller ID= 4, Queue= 1 DELETE operation : Caller ID= 5, Queue= 1 DELETE operation : Caller ID= 8, Queue= 1 DELETE operation : Caller ID= 10, Queue= 1 DELETE operation : Caller ID= 13, Queue= 1 DELETE operation : Caller ID= 11, Queue= 2 Program is ended. EXAMPLE PROGRAM The following is an example C++ program illustrating : how to define an array of STL queues, • how to add a Caller ID number to a randomly selected queue, and how to delete a Caller ID number from a randomly selected queue. // Filename: example.cpp #include <stdio.h> // For printf function #include <stdlib.h> // For srand and rand functions #include <time.h> // For time function #include <queue> // For STL queue class using namespace std; // C++ requirement int main() { queue <int> Q[3]; I/ Array of STL queues (3 queues), which will store caller ID numbers int selected_queue; // Index of a randomly selected queue int caller_ID = 1; int tmp_caller_ID; // Temporary caller ID // Caller ID number srand(time(NULL)); // Seed (initialize) the random number generator /-- selected_queue = rand() % 3; Q[selected_queue).push(caller_ID); // Add a caller ID number to the selected queue printf("ADD operation : Caller ID= %d, Selected Queue= %d \n", caller_ID, selected_queue); // Randomly determine the index number of a queue %3D selected_queue = rand() % 3; if (! Q[selected_queue).empty()) { tmp_caller_ID = Q[selected_queue].front(); // Get (without deleting) a caller ID from selected queue Q[selected_queue].pop(); printf("DELETE operation : Caller ID= %d, Selected Queue= %d \n", tmp_caller_ID, selected_queue); // Randomly determine the index number of a queue // Check if the queue is not empty // Delete a caller ID from the selected queue else printf("DELETE operation : Selected Queue= %d (Queue is empty) \n", selected_queue); }// End of main
Expert Answer:
Answer rating: 100% (QA)
Here is the completed code for the problem It was executed well an... View the full answer
Related Book For
Probability and Stochastic Processes A Friendly Introduction for Electrical and Computer Engineers
ISBN: 978-1118324561
3rd edition
Authors: Roy D. Yates, David J. Goodman
Posted Date:
Students also viewed these programming questions
-
Write a c program to implement phone book dictionary using Binary Search Tree which provides following operations: (a) add new entry in phone book, (b) remove entry from phone book, (c) search phone...
-
How do I write a c program to give me the frequency of letters a - z and A - Z which are read from multiple files? I've been using for loops but I'm only allowed to use a for when looping through the...
-
The SDMA and Adaptive Antennas Techniques will be used for a variety of purposes in LTE and higher mobile broadband systems. Name three of these purposes.
-
Gothic Kings Ltd. Is a 100% owned subsidiary of Hadrian Inc. Gothic has been profitable in the past but incurred a loss for the year ended December 31, 20X3. Hadrian has indicated that if Gothic...
-
An engineer takes a large number of independent measurements of the length of a component and obtains X = 5.2 mm and X = 0.1 mm. Use this information to find the P-value for testing H0 : = 5.0 versus...
-
A test is given to candidates for graduate school. Studies show that \(1 \%\) of the population are qualified for graduate school. If the person is qualified, the probability of passing the test is...
-
Ratio of isothermal horsepower to the shaft horse power to drive a compressor is known as: (a) Volumetric efficiency (b) Mechanical efficiency (c) Overall isothermal efficiency (d) Adiabatic...
-
Gamma Electronics manufactures and sells a line of smart phones. Unfortunately, Gamma Electronics suffered serious fire damage at its home office. As a result, the accounting records for October were...
-
: The system of forces shown in figure is in equilibrium Calculate the unknown force 'P' and angle '0'. P 60 N 45 100 N 60 40 N 80 N
-
Imagine that you have extracted an unmyelinated neuron and have placed it in a sterile petri dish filled with a solution mimicking its natural extracellular envirnoment. you artificially stimulate...
-
Tax administration allows for cross-border transactions. To this end, entities conduct businesses across countries as a way of increasing their competitiveness and international appeal and...
-
Jill Price has an incredible memory. Since she was 15 years old, she can remember everything that she has done and every t.v. show she has watched. What type of memory is special for Jill Price?
-
How might definitions of well-being differ across and within cultures? Why is this important to consider in a clinical psychology or health psychology context?
-
What theories have been used in peer-reviewed research when investigating emotion-based persuasive messages? What has peer-reviewed research revealed about the implications of emotion-based...
-
What is the difference between the fair market value of employer securities at distribution and their cost or other basis to the plan?
-
What statement regarding tuition fees is correct? The tuition tax credit includes the cost of books for students who receive in-class instruction. Full-time students at recognized post-secondary...
-
A (closed) umbrella 1m long is placed 10cm off the optical axis of a convex mirror. It is oriented parallel to the optical axis. The umbrella's tip is 50cm from the mirror (thus the end of its handle...
-
Write a program that initializes an array. It inputs a value from the user and searches the number in the array.
-
The two-dimensional random vector Y has PDF Find the expected value vector E[Y], the correlation matrix RY, and the covariance matrix CY. 030 si 0 otherwise.
-
For a Poisson process N(t) of rate , show that for s < t, the auto-covariance is CN(s, t) = s. If s > t, what is CN(s, t)? Is there a general expression for CN(s, t)?
-
Recreate the plots of Figure 9.3. On the same plots, superimpose the PDF of Yn, a Gaussian random variable with the same expected value and variance. If Xn denotes the binomial (n,p) random variable,...
-
(a) The longitudinal data set "v4c" is in the vertical format; transform it into the horizontal format. (b) Transform the data set you obtained in part (a) back into the vertical format.
-
Prove (9.31) . = BE (GS;S; G) BT, B = (B), B-T (9.31)
-
Suppose \(x \sim N\left(0, u^{2} ight), y \sim N\left(0, \sigma^{2} ight)\), and \(x\) is independent of \(y\). Given \(x+y=1\), find the MLE for \(x\).
Study smarter with the SolutionInn App