-
Notifications
You must be signed in to change notification settings - Fork 14
/
24_April_2021_Employee.py
59 lines (58 loc) · 1.33 KB
/
24_April_2021_Employee.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
class Employee:
def __init__(self,id,name,dep,sal,role):
self.id=id
self.name=name
self.dep=dep
self.sal=sal
self.role=role
def calc_incentive(self,dg):
for i,j in dg.items():
if i.lower().strip()==self.role.lower().strip():
inc=(self.sal*dg[i])/100
self.sal+=inc
return inc
return None
def calc(rg,el,dg):
m=[]
f=0
for i in el:
if f!=0:
if i.role.lower().strip()==rg.lower().strip():
p=i.calc_incentive(dg)
m.append(i)
f+=1
return m
if __name__=="__main__":
t=int(input())
d={}
for i in range(t):
role=input()
ip=int(input())
d[role]=ip
el=[]
n=int(input())
for i in range(n):
id=int(input())
name=input()
dep=input()
sal=int(input())
role=input()
if i!=0:
el.append(Employee(id,name,dep,sal,role))
else:
v=Employee(id,name,dep,sal,role)
el.append(v)
rg=input()
p=v.calc_incentive(d)
if p==None:
print('Employee Not Found.')
else:
print(p)
if v.role.lower().strip()==rg.lower().strip():
print(v.id,v.name,v.sal)
q=calc(rg,el,d)
if len(q)!=0:
for i in q:
print(i.id,i.name,i.sal)
else:
print('Employee Not Found.')