Question
Homework 3: Simple Discrete Even Simulation Using Queues (C++) The assignment: Customers arrive at the bank to make deposits or withdrawals and are served by
Homework 3:
Simple Discrete Even Simulation Using Queues (C++)
The assignment:
Customers arrive at the bank to make deposits or withdrawals and are served by a teller.
The following information is kept in a structure about each customer.
1. A structure named customer contains at least the following information:
int ID; customerId;
customer first name // // as either an array of char or a string
customer last name; // as either an array of char or a string
double amount of deposit or withdrawal
char Transaction Type: Deposit or Withdrawal
int arrival time;
int service time
double Balance: Account balance
int TellerNo; // a value between 1 and 3
2. Create an input file containing the information of at least 35 customers.
3. Create an array of struct: read the customers data from the input file into the array.
4. Create a queue: you can use the standard library template for the queue or you can write your own code for the different queue operations. The queue stores data of type customer.
5. Also submit an output file of all output that is being sent to the console.
What to do:
You need to code at least the following functions:
I. Random number generator
II. Initialization function:
- initialize an int named timer= 0 ;
- initialize an int named clock = 0 ;
- initialize the number of transactions served by each teller to zero
1. Read customers data from the input file into an array of structures.
2. For each customer in the array,
a. Generate a random number between 1 and 3 representing the teller station number.
b. Generate a number between 1 and 10 and add it to the timer, then store it as
the arrival time value for the customer.
III. . Create the queue function
enqueue the customer structure into the queue
IV. Teller Function
4. Dequeue the customers one at a time from the queue and do the following:
a. Add the amount of deposit or subtract the amount of the withdrawal to/from the balance
Step 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