You are on page 1of 3

# (1)

class Employee:

def get_emp(self, name, department, salary):

self.name = name

self.department = department

self.salary = salary

def put_emp(self):

print("Name =", self.name)

print("Department =", self.department)

print("Salary =", self.salary)

employee = Employee()

nm = input("Enter name: ")

dept = input("Enter department: ")

sal = input("Enter salary: ")

employee.get_emp(nm, dept, sal)

employee.put_emp()

#(2)

class student:

def getdata(self, r, n):

self.rollno = r

self.name = n

def putdata(self):

print("Rollno=", self.rollno)

print("Name=", self.name)
class result(student):

def getm(self, p):

self.per = p

def putm(self):

print("Percentage=", self.per)

s = result()

s.getdata(10, "John")

s.putdata()

s.getm(96)

s.putm()

# (3)

class Father:

def Business(self):

print("Father enjoys business work")

class Mother:

def cooking(self):

print("Mother enjoys cooking")

class Child(Father, Mother):

def playing(self):

print("Child loves playing")

c = Child()

c.Business()

c.cooking()

c.playing()

You might also like