-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLecturer.py
75 lines (63 loc) · 2.34 KB
/
Lecturer.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
65
66
67
68
69
70
71
72
73
74
75
from Human import Human
from Laptop import Laptop
from Assistant import Assistant
# define the Lecturer class which inherits from Human
class Lecturer(Human):
_nip = ""
_markers = []
_laptop = Laptop("")
_assistants = []
_taught = False
def __init__(self, name, gender, nip):
super().__init__(name, gender)
self._nip = nip
def getNip(self):
return self._nip
def addMarker(self, marker):
if isinstance(marker, list):
self._markers.extend(marker)
else:
self._markers.append(marker)
def displayMarker(self):
print("Marker list:")
if self._markers:
for i, marker in enumerate(self._markers):
print(f"{i+1}. {marker}")
def addLaptop(self, laptop):
self._laptop = laptop
def addAssistant(self, assistant):
if isinstance(assistant, Assistant):
if isinstance(assistant, list):
self._assistants.extend(assistant)
else:
self._assistants.append(assistant)
def displayAssistant(self):
print("Assistant:")
if self._assistants:
for i, assistant in enumerate(self._assistants):
print(f"{i+1}. {assistant.getName()}")
def teach(self, subject):
print(f"{self._name} is teaching {subject}.")
self._taught = True
def giveAssignment(self, task, student):
if self._taught:
self._taught = False
if isinstance(student, list):
for i in student:
i.addTask(task)
print(f"{self._name} is giving {task} to Students.")
else:
student.addTask(task)
print(f"{self._name} is giving {task} to {student.getName()}.")
else:
print("You must teach first before giving a assignment!")
def giveScore(self, score, student):
student.setScore(score)
print(f"{self._name} gave {score} to {student._name}.")
def displayAll(self):
print(f"Nama : {self.getName()}")
print(f"Gender : {self.getGender()}")
print(f"NIP : {self.getNip()}")
print(f"Laptop : {self._laptop.getBrand()}")
self.displayMarker()
self.displayAssistant()