Redo the example shown in Listing 12.12, using the STL queue template class instead of the Queue
Question:
Redo the example shown in Listing 12.12, using the STL queue template class instead of the Queue class described in Chapter 12.
Transcribed Image Text:
Listing 12.12 bank.cpp
// bank.cpp -- using the Queue interface
// compile with queue.cpp
#include
Listing 12.12 bank.cpp
// bank.cpp -- using the Queue interface
// compile with queue.cpp
#include
#include // for rand() and srand()
#include // for time()
#include "queue.h"
const int MIN_PER_HR = 60;
bool newcustomer (double x); // is there a new customer?
int main()
{
using std::cin;
using std::cout;
using std::endl;
using std::ios_base;
// setting things up
std::srand (std::time (0)); // random initializing of rand()
cout << "Case Study: Bank of Heather Automatic Teller\n";
cout << "Enter maximum size of queue: ";
int qs;
cin >> qs;
Queue line (gs);
// line queue holds up to qs people
cout << "Enter the number of simulation hours: ";
int hours;
// hours of simulation.
cin >> hours;
// simulation will run 1 cycle per minute
long cyclelimit = MIN_PER_HR hours; // # of cycles
*
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 83% (6 reviews)
ANSWER include include for rand and srand include for time include const int MINPERHR 60 bool newcus...View the full answer
Answered By
Dennis Nyangau
I have been tutoring for several years now, and I absolutely love it! I love being able to help students one-on-one and see them succeed. It is so gratifying to see a student understand a concept that they were struggling with before. I also enjoy getting to know my students and helping them to reach their full potential.
0.00
0 Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
Example 13.1 in this chapter described a twofactor study examining performance under two audience conditions (factor B) for high and low self-esteem participants (factor A). The following summary...
-
In Chapter 12 (page 390), we described a study reporting that college students who are on Facebook (or have it running in the background) while studying had lower grades than students who did not use...
-
In Chapter 1, we described graphically using a frequency distribution table and a histogram the time (in seconds) for a random sample of n = 110 employees to complete a particular task. Describe the...
-
1. What are the advantages to Southwest of its proactive approach to passenger problems? n n 2. How might Fred Taylor use the four-part plan suggested in this chapter to compose his apology letters...
-
Link at the Web site to Planet Rating a French organization that calls itself the global microfinance rating agency. What is the main function of Planet Rating? How might its work help the...
-
How are product prices determined?
-
In December 2008, Jason Garcia signed a motor vehicle sales contract with Mac Haik Dodge Chrysler Jeep, a dealer. In the contract, Garcia agreed to purchase a 2009 Dodge Ram 1500. The contract...
-
Ians place sells pet supplies to dog and cat owners. To sell its products, the marketing department requires sales personnel to call on the pet store retailers within their assigned geographic...
-
v = [-21 0]T V = [101]T V1 Are the basis vectors v and v orthogonal? (Provide proof of your answer) the current basis vectors are not orthogonal, use projection to find v, the component of v...
-
During the next four months, a customer requires, respectively, 500, 650, 1000, and 700 units of a commodity, and no backlogging is allowed (that is, the customers requirements must be met on time)....
-
If you could make the mechanical equivalent of a stack that held golf clubs instead of numbers, why would it (conceptually) be a bad golf bag?
-
Do the same problem as described in Programming Exercise 4, except make it a template function: template int reduce(T ar[], int n); Test the function in a short program, using both a long...
-
Complete TRY THIS Exercise 2, and then modify the IPO chart information and C++ instructions to indicate that the prices of the latex and Mylar balloons will always be $2.25 and $3.75, respectively....
-
An economy is in a recession with a large recessionary gap and a government budget deficit. a. Is the government budget deficit a structural deficit or a cyclical deficit? Explain. b. Explain how...
-
Why might Venezuelas monetary authorities decide to cut interest rates in this situation? To work Problems 28 to 30, use the information that Venezuelas economy is expected to witness a staggering...
-
When does profit sharing not create a partnership?
-
Juan Ramoss wife, Maria, became concerned after a violent storm caused disastrous flooding in a community not too far down the river from where their house was located. She felt comforted when her...
-
What further actions might the Fed take in 2021 to influence the real GDP growth in 2022? The IMF projected a global growth rate of 6% in 2021, the highest rate since the 1970s, as vaccine...
-
Refrigerant-134a is to be compressed from 0.2 MPa and -5oC to 1 MPa and 50oC steadily by an adiabatic compressor. Taking the environment conditions to be 20oC and 95 kPa, determine (a) The specific...
-
Which provision could best be justified as encouraging small business? a. Ordinary loss allowed on $ 1244 stuck. b. Percentage depletion. c. Domestic production activates deductions. d. Interest...
-
Implement the four-input odd-parity function with AND and OR gates using bubbled inputs and outputs.
-
Assume that X consists of 3 bits, x2 x1 x0. Write four logic functions that are true if and only if X contains only one 0 X contains an even number of 0s X when interpreted as an unsigned binary...
-
Derive the product-of-sums representation for E shown on page B-11 starting with the sum-of-products representation. You will need to use DeMorgans theorems.
-
discuss the role of advanced concurrency control mechanisms, such as optimistic concurrency control (OCC), multi-version concurrency control (MVCC), and Serializable Snapshot Isolation (SSI), in...
-
7. Write the following quadratic equation in factored form: y = 9x+6x+1 8. Write the following quadratic equation in vertex form: y= x+8x+3 Give the vertex and axis of symmetry. 9. Show that the...
-
How do we find similarity between products based on what customers buy in different baskets? Can collaborative filtering be used to find similarities? What similarities are appropriate in this...
Study smarter with the SolutionInn App