-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomer.java
57 lines (47 loc) · 1.05 KB
/
Customer.java
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* Creates customer objects that tracks the time they entered the line, their
* priority in line, and whether they are a patron customer
*
* @author Connor 4-9-21
*
*/
public class Customer implements Comparable<Customer> {
public int time;
public int priority;
public boolean patron;
// Constructor
public Customer(int time, int priority, boolean patron) {
this.time = time;
this.priority = priority;
this.patron = patron;
}
public void setTime(int value) {
this.time = value;
}
public int getTime() {
return this.time;
}
public void setPriority(int value) {
this.priority = value;
}
public int getPriority() {
return this.priority;
}
public void setPatron(boolean value) {
this.patron = value;
}
public boolean getPatron() {
return this.patron;
}
// Allows for comparison between customers based off their priority
@Override
public int compareTo(Customer x) {
if (this.getPriority() > x.getPriority()) {
return 1;
} else if (this.getPriority() < x.getPriority()) {
return -1;
} else {
return 0;
}
}
}