Sunday, 23 January 2022

Define a class Employee having members id, name, department, salary. Create a subclass called manager with a member bonus. Define methods accept and display in both classes. Create n objects of the manager class and display the details of the manager having the maximum total salary (salary+bonus)

Slip 4 Q 2

CODE :


class Employee:
    def __init__(self, id, name, department, salary):
        self.id=id
        self.name=name
        self.department=department
        self.salary=salary
       
class manager(Employee):
    def __init__(self, id, name, department, salary ,bonus):
        super(manager, self).__init__(id, name, department, salary)
        self.bonus=bonus
       
    def totalsalary(self):
        print(self.name,'got total salary :',self.salary+self.bonus)
       
n=manager('A023','AMAR','GENERAL MANAGEMENT',20000,8000)
m=manager('A025','priya','MARKETIG',25000,6400)
n.totalsalary()
m.totalsalary()



OUTPUT:




No comments:

Post a Comment

Write a Java program to display given extension files from a specific directory on server machine.

 DOWNLOAD     SLIP14Q2 /** * STEPS TO RUN CODE * Step 01 compile the code * Step 02 run the code * Step 03 give a file directory locatio...