-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomer.java
66 lines (59 loc) · 1.79 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
58
59
60
61
62
63
64
65
66
package cs2030.simulator;
/**
* Customer class represents a Customer who has an id, arrival time,
* service time and a boolean indicator of whether customer is greedy.
*/
public class Customer {
private final int id;
private final double arrivalTime;
private final double serviceTime;
private final boolean greedyCustomer;
/**
* This will initialise a new customer object.
* @param id customer id
* @param arrivalTime customer arrival time
* @param serviceTime customer service time
* @param boolean greedy customer
*/
public Customer(int id, double arrivalTime, double serviceTime, boolean greedyCustomer) {
this.id = id;
this.arrivalTime = arrivalTime;
this.serviceTime = serviceTime;
this.greedyCustomer = greedyCustomer;
}
/**
* This will get the id of customer.
* @return return the id of customer
*/
public int getID() {
return this.id;
}
/**
* This will get the arrival time of customer.
* @return return the arrival time of customer
*/
public double getArrivalTime() {
return this.arrivalTime;
}
/**
* This will get the service time of customer.
* @return return the service time of customer
*/
public double getServiceTime() {
return this.serviceTime;
}
/**
* This will get the boolean of whether customer is a greedy customer.
* @return return true if customer is greedy
*/
public boolean isGreedy() {
return this.greedyCustomer;
}
@Override
public String toString() {
if (isGreedy()) {
return String.format("%d(greedy)", this.id);
}
return String.format("%d", this.id);
}
}