-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoom.java
77 lines (67 loc) · 1.58 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
package STassgn;
public class Room {
int vip;
int deluxe;
int standard;
DisplayUtilities du;
public Room(int vip, int deluxe, int standard) {
this.vip = vip;
this.deluxe = deluxe;
this.standard = standard;
this.du = new DisplayUtilities();
}
public Room() {
vip = 1;
deluxe = 2;
standard = 3;
}
public int getVIP() {
return vip;
}
public int getDeluxe() {
return deluxe;
}
public int getStandard() {
return standard;
}
public String getType() {
if (vip > 0) {
return "VIP";
} else if (deluxe > 0) {
return "Deluxe";
} else if (standard > 0) {
return "Standard";
} else {
return "No rooms available"; // Handle case when no rooms are available
}
}
// Method to check if a room of a specific type is available
public boolean checkRoom(String roomType) {
switch (roomType) {
case "VIP":
return vip > 0;
case "Deluxe":
return deluxe > 0;
case "Standard":
return standard > 0;
default:
return false; // Invalid room type
}
}
public void cancelBooking(String roomType) {
switch(roomType) {
case "VIP":
vip++;
break;
case "Deluxe":
deluxe++;
break;
case "Standard":
standard++;
break;
default:
du.showToScreen("Invalid room type");
break;
}
}
}