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: 71% (7 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...
-
The centerboard on a sailboat is 3 ft long parallel to the flow and protrudes 7 ft down below the hull into seawater at 20C. Using flat-plate theory for a smooth surface estimate its drag if the boat...
-
For a given data set containing 26 points, the assumptions of the linear model are satisfied. The following values are computed: b1 = 46.8 and sb = 15.2. Perform a test of the hypothesis H0 : 1 = 0...
-
Chester has a new design for their product Cone next round that can reduce their material cost of producing units from $8.14 to $7.32. Chester passes on half of all cost savings by cutting the...
-
Differential Analysis for a Lease or Buy Decision Laredo Corporation is considering new equipment. The equipment can be purchased from an overseas supplier for $3,160. The freight and installation...
-
Consider the project data model shown in Figure 1-15. a. Create a textual description of the diagrammatic representation shown in the figure. Ensure that the description captures the...
-
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...
-
List and briefly describe the five categories of business ratios.
-
What is a technical review?
-
How do you plan a mission?
-
What is total quality management (TQM)? Why is it important in project management?
-
What is the objective of the Post-Mission Phase of Operation? How do we bound its starting and ending points?
-
Identify the causes of changes to projects, and how to control those changes.
-
Figure 6.48a shows examples of products that can be obtained by slicing long extruded sections into discrete parts name several other products that can be made in a similar manner.
-
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.
-
Some enterprising physics students working on a catapult decide to have a water balloon fight in the school hallway. The ceiling is of height 3 . 4 m, and the balloons are launched at a velocity of 9...
-
1-Define electric fields and how it helps us understand electricity. 2-Electric fields are represented as a physical effect of a configuration of charges that is created by the attraction of electric...
-
Why thin film on a glass surface can remove completely reflections at certain light wavelength? Magnesium fluoride (n = 1.38) is used as coating on nonreflecting glass. How thin coating is enough to...
Study smarter with the SolutionInn App