-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from employee import Employee | ||
|
||
|
||
class Developer(Employee): | ||
_name = None | ||
_salary = None | ||
|
||
def __init__(self, name, salary): | ||
self._name = name | ||
self._salary = salary | ||
|
||
def add(self, employee): | ||
# leaf node cannot add employees | ||
pass | ||
|
||
def remove(self, employee): | ||
# leaf node cannot remove employees | ||
pass | ||
|
||
def get_name(self): | ||
return self._name | ||
|
||
def get_salary(self): | ||
return self._salary | ||
|
||
def print_data(self): | ||
print("Developer name: " + self.get_name() + | ||
" with salary: " + str(self.get_salary())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class Employee: | ||
def add(self, employee): | ||
pass | ||
|
||
def remove(self, employee): | ||
pass | ||
|
||
def get_name(self): | ||
pass | ||
|
||
def get_salary(self): | ||
pass | ||
|
||
def print_data(self): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from manager import Manager | ||
from developer import Developer | ||
|
||
|
||
def main(): | ||
manager_one = Manager("Georgi", 4000) | ||
manager_two = Manager("Tsvetomir", 5000) | ||
manager_three = Manager("Spasimir The Boss", 7000) | ||
developer_one = Developer("Atanas", 2500) | ||
developer_two = Developer("Ivan", 3000) | ||
developer_three = Developer("Petar", 3500) | ||
developer_four = Developer("Anastas", 4000) | ||
developer_five = Developer("Evgeni", 4000) | ||
|
||
manager_one.add(developer_one) | ||
manager_one.add(developer_two) | ||
manager_two.add(developer_three) | ||
manager_two.add(developer_four) | ||
manager_three.add(developer_five) | ||
manager_three.add(manager_one) | ||
manager_three.add(manager_two) | ||
|
||
manager_three.print_data() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from employee import Employee | ||
|
||
|
||
class Manager(Employee): | ||
_name = None | ||
_salary = None | ||
_employees = None | ||
|
||
def __init__(self, name, salary): | ||
self._name = name | ||
self._salary = salary | ||
self._employees = [] | ||
|
||
def add(self, employee): | ||
self._employees.append(employee) | ||
|
||
def remove(self, employee): | ||
self._employees.remove(employee) | ||
|
||
def get_name(self): | ||
return self._name | ||
|
||
def get_salary(self): | ||
return self._salary | ||
|
||
def print_data(self): | ||
print("Manager name: " + self.get_name() + | ||
" with salary: " + str(self.get_salary())) | ||
|
||
for employee in self._employees: | ||
employee.print_data() |