forked from ashishps1/awesome-low-level-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparking_lot_demo.py
More file actions
32 lines (25 loc) · 845 Bytes
/
parking_lot_demo.py
File metadata and controls
32 lines (25 loc) · 845 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
from parking_lot import ParkingLot
from level import Level
from car import Car
from motorcycle import Motorcycle
from truck import Truck
class ParkingLotDemo:
def run():
parking_lot = ParkingLot.get_instance()
parking_lot.add_level(Level(1, 100))
parking_lot.add_level(Level(2, 80))
car = Car("ABC123")
truck = Truck("XYZ789")
motorcycle = Motorcycle("M1234")
# Park vehicles
parking_lot.park_vehicle(car)
parking_lot.park_vehicle(truck)
parking_lot.park_vehicle(motorcycle)
# Display availability
parking_lot.display_availability()
# Unpark vehicle
parking_lot.unpark_vehicle(motorcycle)
# Display updated availability
parking_lot.display_availability()
if __name__ == "__main__":
ParkingLotDemo.run()