You are on page 1of 1

Name: Akhilesh Milind Dolare

Roll No: 17
Class: TYCM1
Batch: C
Practical No: 14-A

1) Design a class employee with data members: name, department and salary. Create Suitable
methods for reading and printing employee information.

class Employee:
def __init__(self, name, dept, salary):
self.name=name
self.dept=dept
self.salary=salary

def myfunc(display):
print("Information: \n")
print("Name: "+ display.name)
print("Department: "+ display.dept)
print("Salary: "+ display.salary)

e1 = Employee("Akhilesh ", "IT ", "4500000")


e1.myfunc()

Output:

Information:

Name: Akhilesh
Department: IT
Salary: 4500000

2) Design a class to show use of parameterized constructor.


Ans:

class person:
def __init__(self):
self.name="Akhilesh Dolare"

def display(self):
print(self.name)

obj = person()
obj.display()

Output:

Akhilesh Dolare

You might also like