-
Notifications
You must be signed in to change notification settings - Fork 0
/
hospital.py
33 lines (27 loc) · 921 Bytes
/
hospital.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
from administrator import Administrator
from doctor import Doctor
from nurse import Nurse
class Hospital:
def __init__(self):
self._employees = [
Administrator("Eric", "Muganga", "0234456750", "admin", "admin"),
Doctor("Derek", "Gisa", "303094499", "derek", "derek", "12304", "Cardiologist")
]
@property
def employees(self):
return self._employees
@employees.setter
def employees(self, value):
self._employees = value
def add_employee(self, employee):
self._employees.append(employee)
def user_exists(self, username):
for empl in self._employees:
if empl.username == username:
return True
return False
def get_employee_by_username(self, username):
for empl in self._employees:
if empl.username == username:
return empl
return None