customer service simulation

Description

Modify or rewrite the Queue class given to simulate customer arrivals at the Department of Motor Vehicles (DMV) counter.

As customers arrive, they are given a ticket number starting at 1. When a customer service agent is free, the customer with the next ticket number is called. This system results in a FIFO queue of customers. Write a program that implements the queue and simulates customers entering and leaving the queue. Input into the queue should be the ticket number and a getin_time when the ticket was entered into the queue. A ticket and its corresponding getin_time is removed when a customer service agent handles the next customer.

Your program will also save the length of time the last 3 customers spent waiting. Every time a ticket is removed from the queue, update these times and output the average of the last three customers as an estimate wait time.

If nobody is in the queue, output that the line is empty.

Queue Class

Modify or rewrite the following queue class implementation, or the one in display 13.21 through 13.23:

queue.h

queue.cpp

What to Submit

Submit for this lab your program file in .cpp and/or .h.

Bonus Points

Add a try-throw-catch block in your code for a 20 point bonus. Please claim the bonus by answering Q2 in in the Problems Encountered & Bonus Claim section.

Requirements

  1. Impeccable comments and programming style
  2. Your code will not cause any runtime errors such as segmentation faults
  3. Answer the questions in the Problems Encountered & Bonus Claim section

Tips

  1. Consider adding member variables in your modified Queue class for wait time calculation
  2. Use visual aids to help you understand your plan for the function
  3. Consider boundary cases, such as:
    1. When the list is empty
    2. When the list has only one node
  4. You might want to “rewrite” or “copy/type out” other functions that are already implemented to solidify your understanding with linked list first

Demo

The line is empty.
Enter '1' to simulate a customer's arrival, '2' to help the
next customer, or '3' to quit.
1
Customer 1 entered the queue at time 100000044.
Enter '1' to simulate a customer's arrival, '2' to help the
next customer, or '3' to quit.
1
Customer 2 entered the queue at time 100000049.
Enter '1' to simulate a customer's arrival, '2' to help the
next customer, or '3' to quit.
1
Customer 3 entered the queue at time 100000055.
Enter '1' to simulate a customer's arrival, '2' to help the
next customer, or '3' to quit.
2
Customer 1 is being helped at time 100000069. Wait time = 25
seconds.
The estimated wait time for customer 2 is 25 seconds.
Enter '1' to simulate a customer's arrival, '2' to help the
next customer, or '3' to quit.
2
Customer 2 is being helped at time 100000076. Wait time = 27
seconds.
The estimated wait time for customer 3 is 26 seconds.
Enter '1' to simulate a customer's arrival, '2' to help the
next customer, or '3' to quit.
1
Customer 4 entered the queue at time 100000080.
Enter '1' to simulate a customer's arrival, '2' to help the
next customer, or '3' to quit.
2
Customer 3 is being helped at time 100000099. Wait time = 44
seconds.
The estimated wait time for customer 4 is 32 seconds.

 
Looking for a similar assignment? Our writers will offer you original work free from plagiarism. We follow the assignment instructions to the letter and always deliver on time. Be assured of a quality paper that will raise your grade. Order now and Get a 15% Discount! Use Coupon Code "Newclient"