-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppt.java
49 lines (41 loc) · 919 Bytes
/
Appt.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
//Ashley Zhang + Grace Gent
public class Appt implements Comparable<Appt>
{
private String name;
private Time start;
private Time end;
public Appt(String n, Time s, Time e) {
name = n;
start = s;
end = e;
}
public void setStart(Time s) {
start = s;
}
public void setEnd(Time e) {
end = e;
}
public Time getStart() {
return start;
}
public int minBetween(Appt other) {
return end.minBetween(other.getStart());
}
public String toString() {
if(start != null) {
return name + " from " + start + " to " + end;
}
else {
return name;
}
}
public int compareTo(Appt other) {
if(start.compareTo(other.getStart()) < 0) {
return -1;
}
else if(start.compareTo(other.getStart()) > 0) {
return 1;
}
return 0;
}
}