PRACTICAL 15
#1. Create a class Employee with data members: name, department and salary. Create
suitable methods for reading and printing employee information.
class Employee:
def get(self):
self.name=input("Enter Employee name: ")
self.dep=input("Enter Department: ")
self.salary=int(input("Enter Salary: "))
def put(self):
print("\nDetails of the Employee:")
print("Name: ",self.name)
print("Department: ",self.dep)
print("Salary: ",self.salary)
obj=Employee()
obj.get()
obj.put()
#2. Python program to read and print students information using two classes using
simple inheritance.
class A:
def get(self):
self.roll=int(input("\nEnter Roll No:"))
self.name=input("Enter Name:")
class B(A):
def show(self):
print("\nRoll No:",self.roll)
print("Name:",self.name)
obj=B()
obj.get()
obj.show()
#3. Write a Python program to implement multiple inheritance
class A:
def get(self):
self.roll=int(input("\nEnter Roll No:"))
self.name=input("Enter Name:")
self.per=int(input("Enter Percentage:"))
class B(A):
def show(self):
print("\nRoll No:",self.roll)
print("Name:",self.name)
class C(B):
def dis(self):
print("Percentage:",self.per)
obj=C()
obj.get()
obj.show()
obj.dis()
OUTPUT :-