forked from MissMeriel/ShoppingCenterSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExpressLine.java
More file actions
34 lines (30 loc) · 890 Bytes
/
ExpressLine.java
File metadata and controls
34 lines (30 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package master1;
/**
* DSA Project Express checkout line for customers with 5 items or fewer
* @author Meriel Stein
* @version 11.23.2016
*/
public class ExpressLine extends CheckoutLine {
/**
* Constructor for an ExpressLine with a name
* @param name the name to set for an express line
*/
public ExpressLine(String name){
super(name);
}
/**
* Adds customer to the end of the checkout queue if customer has 4 items or
* less in their shopping cart.
*
* @param c customer lining up at the back of the checkout queue.
* @throws CheckoutLineException when a customer has more than the maximum items allowed in express line
*/
@Override
public void addCustomer(Customer c) throws CheckoutLineException {
if (c.getCart() <= 4) {
line.enqueue(c);
} else {
throw new CheckoutLineException("Customer has more than 4 items in shopping cart");
}
}
}