Write a class named Employee that holds the following data about an employee in
ID: 3706651 • Letter: W
Question
Write a class named Employee that holds the following data about an employee in attributes: name, ID number, department, and job title. Don't include a constructor or any other methods. Once you have written the class, write a program that creates three employee objects to hold the following data:
Name, ID number, Department, Job Title
Susan Meyers, 47899, Accounting, Vice president
Marke Jones, 39119, IT, programming
Joy Rogers, 81774, Manufacturing, Engineering
The program should store its data in three employee objects and then print the data for each employee.
(End of part1)
• Write a class named Employee that holds the following data about an employee in attributes: name, ID number, department, and job title.
• Create a UML diagram for Employee class.
• Create a program that stores Employee objects in a dictionary. Use the employee ID number as the key. The program should present a menu that lets the user perform the following actions:
? Look up an employee in the dictionary
? Add a new employee to the dictionary
? Change an existing employee’s name, depart, and job title in the dictionary
? Delete an employee from the dictionary
? Quit the program
When program ends, it should pickle the dictionary and save it to a file. Each time the program starts, it should try to load the pickled dictionary from the file. If the file does not exist, the program should start with an empty dictionary.
(end of part2)
can someone help me with this? I have been going at it for a week and nothing seems to click. This is in Python
Explanation / Answer
coding:
class Employee:
'Employee class'
def __init__(self, name, idnum, dept, jobtit):
self.name = name
self.idnum = idnum
self.dept = dept
self.jobtit = jobtit
def main():
emp1 = Employee("Susan Meyers","47899","Accounting","Vice President")
emp2 = Employee("MArk Jone","39119","IT","Programmer")
emp3 = Employee("Joy Rogers","81774","Manufacturing","Engineer")
print "Employee details"
print "Emp1 name : ",emp1.name
print "Emp1 name : ",emp1.idnum
print "Emp1 name : ",emp1.dept
print "Emp1 name : ",emp1.jobtit
print "Emp2 name : ",emp2.name
print "Emp2 name : ",emp2.idnum
print "Emp2 name : ",emp2.dept
print "Emp2 name : ",emp2.jobtit
print "Emp3 name : ",emp3.name
print "Emp3 name : ",emp3.idnum
print "Emp3 name : ",emp3.dept
print "Emp3 name : ",emp3.jobtit
main()
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.