-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFloor.java
31 lines (31 loc) · 881 Bytes
/
Floor.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
public class Floor {
private int floorNumber;
private boolean upRequest;
private boolean downRequest;
public Floor(int floorNumber) {
this.floorNumber = floorNumber;
this.upRequest = false;
this.downRequest = false;
}
public int getFloorNumber() {
return floorNumber;
}
public void requestUp() {
this.upRequest = true;
System.out.println("Up request at floor " + floorNumber);
}
public void requestDown() {
this.downRequest = true;
System.out.println("Down request at floor " + floorNumber);
}
public boolean hasUpRequest() {
return upRequest;
}
public boolean hasDownRequest() {
return downRequest;
}
public void clearRequests() {
this.upRequest = false;
this.downRequest = false;
}
}