- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInheritanceSample.py
More file actions
Latest commit
71 lines (66 loc) · 2.34 KB
/
Copy pathInheritanceSample.py
File metadata and controls
71 lines (66 loc) · 2.34 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
classemployee:
def__init__(self, ename, ecode, ebs):
self.emp_name=ename
self.emp_code=ecode
self.emp_basic=ebs
defcalculate(self):
ifself.emp_basic<10000:
self.emp_da=self.basic* (2/100)
self.emp_hra=self.basic* (3/100)
self.emp_pf=self.basic* (4/100)
else:
self.emp_da=self.basic* (2/100)
self.emp_hra=self.basic* (3/100)
self.emp_pf=self.basic* (4/100)
self.emp_ns=self.basics+self.da+self.hra-self.pf
defdisplay(self):
print("Name:", self.emp_name)
print("EmpCode:", self.emp_code)
print("Basic Salary:", self.emp_basic)
print("DA:", self.emp_da)
print("HRA:", self.emp_hra)
print("PF:", self.emp_pf)
print("Net Salary:", self.emp_pf)
classteacher(employee):
def__init__(self,enm,ecd,ebs,dept):
employee.__init__(self,enm,ecd,ebs)
self.department=dept
self.student=[]
defmark_attendence(self,n):
self.count=n
print("Enter the attendance roollno wise(p-present/a-absent)")
foriinrange(0,n):
att=input()
self.student.append(att)
defdisplay_attendance(self):
c=0
print("Count of present students")
foriinrange(0,self.count):
ifself.student[i].low()=="p":
c=c+1
print(c)
defdisplay(self):
print("Name:", self.emp_name)
print("EmpCode:", self.emp_code)
print("Department:", self.department)
print("Basic Salary:", self.emp_basic)
print("DA:", self.emp_da)
print("HRA:", self.emp_hra)
print("PF:", self.emp_pf)
print("Net Salary:", self.emp_ns)
teacher_list=[]
m=int(input("Enter the number of teachers"))
foriinrange(0,m):
name=input("Enter the name of teachers")
c=input("Enter the code of teachers")
bs=int(input("Enter the basic salary of teachers"))
dept=input("Enter the department of teachers")
no=int(input("Enter the department of teachers"))
tchr=teacher(name,c,bs,dept)
tchr.mark_attendence(no)
tchr.calculate()
teacher_list.append(tchr)
foriinrange(0,m):
print("___________________________")
teacher_list[i].display()
teacher_list[i].display_attendance()