|
PDC
|
#include <Register.h>
Public Member Functions | |
| void | advanceTime (int t) |
| void | push (const int val) |
Protected Attributes | |
| int | remaining |
Static Protected Attributes | |
| static int | transactTime = 10 |
Represents a register line in a store checkout area. Each integer in the base queue represents a cart to be processed. Time is measured in units for scanning a single item in a cart.
|
inline |
Advance this register's simulation by a specified amount of time
| t | non-negative number of units of time to advance the register |
while t>0 and a cart remains in the queue:
if remaining > t:
subtract t units from remaining, and set t=0
print message about progress on that cart
else:
subtract remaining units from t
print message about completion of that cart
remove that cart from the queue
if a next cart exists in the queue:
remaining = transactTime + (number of items in that next cart)
if no carts remain:
print message about no carts remaining
|
inline |
Override queue::push to maintain remaining in the case of an empty queue
| val | Represents a new cart |
|
protected |
Remaining time to complete front cart in queue; no specified value for an empty queue
|
staticprotected |
time per cart to perform a transaction
1.8.11