Description of the assessment:
This assignment has three tasks.
(1) Write an Employee class with the following attributes and methods:
Attributes (variables):
id, name, department, salary, years of service
Methods:
addEmpDetails(): to add items in the employee list
delEmpDetails(): to delete employee from the list
getEmpDetails(): to access the employee details
saveEmpDetails_File(): to save the employee information in a .txt file
emp_service_years(): to print the IDs and names of employees who worked for 10 years and more.
change_dept(): change the employee's department information if they change the department.
The details of the employees are in the following Table 1. In the main function:
(a) Add employee information given in Table 1 using addEmpDetails() method.
(b) Test the getEmpDetails() method by printing the employee details.
(c) Test the emp_service_years method by printing the names and IDs of the employees who worked for 10 years and more.
(d) Call the respective method that saves the employee information in a file and check if it has correctly saved all the information in the file.
(e) Test the change_dept() method to change any employee's department (print employee details to confirm this function works).
(f) Test the delEmpDetails() method, delete any employee's details and print it on the screen to verify if this function works or not.
(g) Write code that display the details of the employee on the screen using the GraphWin object (You can refer to the files provided (display.py and list.txt) as sample)
Table 1: Employee information
(2) Write and test functions that return summation of all the numbers (items) in the list. For this task do the following:
a. Ask the user to enter a list of numbers and you build up a list with those numbers
b. Write a recursive function that returns thesummation of all the numbers in the list
c. Write a iterative function that returns the summation of all the number in the list
d. You need to provide a piece of code to show how you tested the functions
e. Verify the results from the recursive and iterative functions (from steps b and c).
(3) Modify the code for question 2 to include exception handling mechanism to catch potential errors. Your code should:
a. Catch at least two types of errors
b. It should display a message for the user showing the type of error and possible solution to correct this error.