-
Notifications
You must be signed in to change notification settings - Fork 0
/
floorsClass.py
64 lines (49 loc) · 1.75 KB
/
floorsClass.py
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
class FloorsClass():
"""
class that will manage floors.
isUp, isDown - buttons outside elevator.
"""
def __init__(self, in_number_of_floors):
self.floorsArray = []
for i in range(in_number_of_floors):
fl = FloorClass(i)
self.floorsArray.append(fl)
def printFloorsButtOn(self):
"""
printing floor buttons that are pressed and there direction
"""
locals =[]
for i in self.floorsArray:
if i.isDown: locals.append( ( 'down: '+ i.floorNumber ) )
elif i.isUp: locals.append( ( 'up: '+ i.floorNumber ) )
print("buttton's array pushed on floors :\n",locals)
def floor_turn_on_PushDown(self, floorNumber):
"""
pressing on button outside the floor.
"""
print(f'press down on {floorNumber} floor ')
self.floorsArray[floorNumber].isDown = True
def floor_turn_off_PushDown(self, floorNumber):
"""
pressing on button outside the floor.
"""
self.floorsArray[floorNumber].isDown = False
def floor_turn_on_PushUp(self, floorNumber):
"""
pressing on button outside the floor.
"""
print(f'press up on {floorNumber} floor ')
self.floorsArray[floorNumber].isUp = True
def floor_turn_off_PushUp(self, floorNumber):
"""
pressing on button outside the floor.
"""
self.floorsArray[floorNumber].isU = False
class FloorClass():
"""
class that will represent floor Button(outside elevator).
"""
def __init__(self, floorNumber):
self.isUp=False
self.isDown=False
self.floorNumber = floorNumber