Define a class Employee having members id, name, department, salary. Create a subclass called manager with member bonus. Define methods accept and display in both the classes. Create n objects of the manager class and display the details of the manager having the maximum total salary (salary+bonus).
class Employee:
def AcceptEmp(self):
self.Id=int(input("Enter emp id:"))
self.Name=input("Enter emp name:")
self.Dept=input("Enter emp Dept:")
self.Sal=int(input("Enter emp Salary:"))
def
DisplayEmp(self):
print("Emp id:",self.Id)
print("Emp Name:",self.Name)
print("Emp Dept:",self.Dept)
print("Emp Salary:",self.Sal)
class Manager(Employee):
def AcceptMgr(self):
self.bonus=int(input("Enter Manager Bonus"))
def DisplayMgr(self):
print("Manger Bonus is:",self.bonus)
self.TotalSal=self.Sal+self.bonus
print("Total Salary: ", self.TotalSal)
n=int(input("Enter How may Managers:"))
s=[]
for i in range(0,n):
x=input("Enter Object Name:")
s.append(x)
print(s)
for j in range(0,n):
s[j]=Manager()
s[j].AcceptEmp()
s[j].AcceptMgr()
print("\nDisplay Details of Manager",j+1)
s[j].DisplayEmp()
s[j].DisplayMgr()
maxTotalSal= s[0].TotalSal
maxIndex=0
for j in range(1,n):
if s[j].TotalSal > maxTotalSal:
maxTotalSal= s[j].TotalSal
maxIndex=j
print("\nMaximum Salary(Salary+Bonus)")
s[maxIndex].DisplayEmp()
s[maxIndex].DisplayMgr()