-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoom.java
127 lines (108 loc) · 3.15 KB
/
Room.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import java.util.ArrayList;
import java.util.Date;
public class Room {
private ArrayList<Passenger> occupants;
private ArrayList<Date[]> datesOccupied;
private double price;
private int roomNumber;
private RoomType roomType;
private boolean smokerFriendly;
private int numberBeds;
private BedType bedType;
/**
* Constructor for Room
* @param occupants
* @param datesOccupied
* @param price
* @param roomNumber
* @param roomType
* @param smokerFriendly
* @param numberBeds
* @param bedType
*/
public Room(ArrayList<Passenger> occupants, ArrayList<Date[]> datesOccupied, double price,
int roomNumber, RoomType roomType, boolean smokerFriendly, int numberBeds, BedType bedType) {
this.occupants = occupants;
this.datesOccupied = datesOccupied;
this.price = price;
this.roomNumber = roomNumber;
this.roomType = roomType;
this.smokerFriendly = smokerFriendly;
this.numberBeds = numberBeds;
this.bedType = bedType;
}
/**
* Getters and setters
* @return
*/
public ArrayList<Passenger> getOccupants() {
return occupants;
}
public void setOccupants(ArrayList<Passenger> occupants) {
this.occupants = occupants;
}
public ArrayList<Date[]> getDatesOccupied() {
return datesOccupied;
}
public void setDatesOccupied(ArrayList<Date[]> datesOccupied) {
this.datesOccupied = datesOccupied;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getRoomNumber() {
return roomNumber;
}
public void setRoomNumber(int roomNumber) {
this.roomNumber = roomNumber;
}
public RoomType getRoomType()
{
return roomType;
}
public void setRoomType(RoomType roomType)
{
this.roomType = roomType;
}
public boolean getSmokerFriendly()
{
return smokerFriendly;
}
public void setSmokerFriendly(boolean smokerFriendly)
{
this.smokerFriendly = smokerFriendly;
}
public int getNumberBeds() {
return numberBeds;
}
public void setNumberBeds(int numberBeds) {
this.numberBeds = numberBeds;
}
public BedType getBedType()
{
return bedType;
}
public void setBedType(BedType bedType)
{
this.bedType = bedType;
}
/**
* Converts the room information into a string
*/
public String toString() {
String ret = roomType.getName() + " room " + roomNumber + " with " + numberBeds + " " + bedType.getName() + " beds costing " + price + ".";
if (smokerFriendly) {
ret += " Smoker friendly.";
} else {
ret += " No smoking.";
}
ret += "Dates occupied:\n";
for (int i = 0; i < datesOccupied.size(); i++) {
ret += datesOccupied.get(i)[0] + " - " + datesOccupied.get(i)[1] + "\n";
}
return ret;
}
}