-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGuest.java
More file actions
84 lines (70 loc) · 1.85 KB
/
Guest.java
File metadata and controls
84 lines (70 loc) · 1.85 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
/**
* Guest stores user data such as id, username, check in date, and check out date
*/
public class Guest implements Comparable<Guest>, Serializable{
private int userID;
private String username;
private String password;
private ArrayList<Reservation> reservations;
//testing purposes.
public Guest(int ID, String user, String pass) {
userID = ID;
username = user;
reservations = new ArrayList<Reservation>();
password = pass;
}
public String getPassword() {
return password;
}
public void addReservation(Reservation r)
{
reservations.add(r);
}
public void setPassword(String password) {
this.password = password;
}
public ArrayList<Reservation> getReservations() {
return reservations;
}
/**
* Returns the guest user's ID
* @return userID of the guest
*/
public int getUserID() {
return userID;
}
/**
* Returns the guest's username
* @return the username of the guest
*/
public String getUsername() {
return username;
}
/**
* Sets the user ID of the guest
* @param ID the new user ID
* @postcondition: user ID of the guest is set to the new user ID
*/
public void setUserID(int ID) {
userID = ID;
}
/**
* Sets the username of the guest
* @param user the new username
* @postcondition: username of the guest is set to the new username
*/
public void setUsername(String user) {
username = user;
}
/**
* Overrides compareTo method, comparing guest to another by username
* @param g the guest to compare to
* @returns -1, 0, 1, for less than, equal to, and greater than, respectively
*/
public int compareTo(Guest g) {
return username.compareTo(g.getUsername());
}
}