-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_OOP.py
More file actions
72 lines (49 loc) · 1.52 KB
/
Copy pathpython_OOP.py
File metadata and controls
72 lines (49 loc) · 1.52 KB
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
import matplotlib.pyplot as plt
class Personnel:
def __init__(self, first, last):
self.first = first
self.last = last
@property
def fullname(self):
return '{} {}'.format(self.first.capitalize(), self.last.capitalize())
@property
def email(self):
return '{}.{}@company.com'.format(
self.first.lower(), self.last.lower())
@fullname.setter
def fullname(self, name):
first, last = name.split(' ')
self.first = first
self.last = last
# stu1 = Personnel('Maiya', 'Hee')
# print(stu1.email)
# stu1.first = 'hak'
# print(stu1.email)
# stu1.fullname = 'Mia Maiya'
# print(stu1.email)
class Employee(Personnel):
"""docstring for Employee"""
def __init__(self, first, last, pay):
super().__init__(first, last)
self.pay = pay
class Manager(Employee):
"""docstring for Manager"""
def __init__(self, first, last, pay, employees):
super().__init__(first, last, pay)
if employees is None:
self.employees = []
else:
self.employees = employees
EMP1 = Employee('Jon', 'Red', 100000)
EMP2 = Employee('Vin', 'Jud', 200000)
MGR1 = Manager('Bishal', 'Shakya', 500000, [EMP1, EMP2])
print(MGR1.email)
plt.plot(list(range(8)), [x * x for x in range(8)])
plt.show()
class Staffs(Personnel):
"""docstring for Staffs"""
def __init__(self, first, last, hours):
super().__init__(first, last)
self.hours = hours
MESSAGE = 'hello\'s cafe!'
print(MESSAGE.upper())