public class Customer extends Object
The checkout time required is generated randomly when a customer is created. Specifically, the checkout time required is drawn from a normal distribution having mean equal to 60 seconds and standard deviation equal to 10 seconds. Practically, this means that it takes between 30 and 90 seconds of cashier time to process almost all customer transactions.
Constructor and Description |
---|
Customer(double arrivalTime,
Random rng)
Create a customer that arrives at the checkout line(s) at
arrivalTime . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
double |
getCashierArrivalTime()
Get the time (in seconds) when the customer reaches the front of the
cashier's queue.
|
double |
getCheckoutTimeRequired()
Get the amount of cashier time (in seconds) needed by this customer.
|
double |
getDepartureTime()
Get the time (in seconds) when the customer completes the checkout process
(i.e., leaves the cashier's queue).
|
int |
getId() |
double |
getQueueArrivalTime()
Get the time (in seconds) when the customer arrives at the back of the
cashier's queue.
|
int |
hashCode() |
void |
setCashierArrivalTime(double cashierArrivalTime)
Set the time (in seconds) when the customer reaches the front of the
cashier's queue.
|
public Customer(double arrivalTime, Random rng)
arrivalTime
. The random number generator rng
is
used to set the amount of cashier time needed to service this customer.arrivalTime
- the arrival time of the customerrng
- a random number generatorarrivalTime >= 0
, rng != nullpublic double getQueueArrivalTime()
public double getCheckoutTimeRequired()
public double getCashierArrivalTime()
public void setCashierArrivalTime(double cashierArrivalTime)
cashierArrivalTime + this.getCheckoutTimeRequired()
cashierArrivalTime
- public double getDepartureTime()
public final int getId()