-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoom.java
More file actions
37 lines (31 loc) · 943 Bytes
/
Copy pathRoom.java
File metadata and controls
37 lines (31 loc) · 943 Bytes
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
public class Room {
private String roomType; // **Room Type**
private int roomNumber; // **Room Number**
private boolean isAvailable; // **Availability**
public Room(String roomType, int roomNumber) {
this.roomType = roomType;
this.roomNumber = roomNumber;
this.isAvailable = true; // all rooms start as available
}
public String getRoomType() {
return roomType;
}
public int getRoomNumber() {
return roomNumber;
}
public boolean isAvailable() {
return isAvailable;
}
public void setAvailable(boolean available) {
this.isAvailable = available;
}
@Override
public String toString() {
// e.g. "Room#1 (Single) - Available"
return String.format("Room#%d (%s) - %s",
roomNumber,
roomType,
(isAvailable ? "Available" : "Unavailable")
);
}
}