I need help writing this python program: Write a class named Employee that holds
ID: 3694053 • Letter: I
Question
I need help writing this python program:
Write a class named Employee that holds the following data about an employee in attributes: name, ID number, department and job title. All data attributes should be private. The Employee class should have an __intit__ method that accepts the employee's name, ID number, department and job title as arguments. These values should be assigned to the object's data attributes. Write accessor methods to access the data attributes. Once you have written the class, write a main function that creates three Employee objects to hold the following data.
Name ID Number Department Job Title
Susan Meyers 47899 Accounting Vice President
Mark Jones 39119 IT Programmer
Joy Rogers 81774 Manufacturing Engineer
The program should store the data in the three objects and then display the data for each employee on the screen.
The following is the expected output of the program.
Employee 1:
Name: Susan Meyers
ID number: 47899
Department: Accounting
Job title: Vice President
____________________
Employee 2:
Name: Mark Jones
ID number: 39119
Department: IT
Job title: Programmer
____________________
Employee 3:
Name: Joy Rogers
ID number: 81774
Department: Manufacturing
Job title: Engineer
Explanation / Answer
class Employee:
def __init__(self, name,idnum,dep,title):
self.__name = name
self.__idnum = idnum
self.__dep = dep
self.__title= title
def getname(self):
return self.__name
def getid(self):
return self.__idnum
def getdep(self):
return self.__dep
def gettitle(self):
return self.__title
emp1 = Employee("Susan Meyers",47899,'Accounting','Vice President')
emp2 = Employee('Mark Jones',39119,'IT','Programmer')
emp3 = Employee('Joy Rogers',81774,'Manufacturing','Engineer')
print('Employee 1:')
print('Name:',emp1.getname())
print('ID number:',emp1.getid())
print('Department:',emp1.getdep())
print('Job title:',emp1.gettitle())
print('----------------------------')
print('Employee 2:')
print('Name:',emp2.getname())
print('ID number:',emp2.getid())
print('Department:',emp2.getdep())
print('Job title:',emp2.gettitle())
print('----------------------------')
print('Employee 3:')
print('Name:',emp3.getname())
print('ID number:',emp3.getid())
print('Department:',emp3.getdep())
print('Job title:',emp3.gettitle())