Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 3 - Please avoid using modules Employee Management System Each subsequent phase will depend on previous assignment result, so you should make an effort

Python 3 - Please avoid using modules

Employee Management System

Each subsequent phase will depend on previous assignment result, so you should make an effort to complete each phase on time and ensure that the program is functional before proceeding with the next phase.

Phase 1

Write an employee management system in Python that allows users to add, search, and delete employees. It should store and display five data fields about each employee, which are:

1.Name

2.Employee ID

3.Department

4.Title

5.Salary

The program should display a menu with the following options:

1.Add an Employee

If an employee with the same name already exists, then do not allow adding a new one. Having two employees with the same name is not allowed. While adding an employee you should allow the user to either cancel the operation or re-enter the name again.

2.Find an Employee (By Name)

Implement find an employee by name function. Name search should be case insensitive.

3.Find an Employee (By EID)

Not functional in phase 1. This function will only display a message that this option is functional yet and will be implemented soon.

4.Delete an Employee

Implement delete an employee by name function.

5.Display Statistics

Not functional in phase 1. This function will only display a message that this option is functional yet and will be implemented soon.

6.Display All Employees

Display all employees and their relevant information on the console.

7.Exit

Exit the program.

The memory data structure that holds the information is a dictionary with employee names as key and the rest of the fields as a value. The data fields about each employee should also be organized into a dictionary using key/value pairs (see whiteboard diagram from the classroom discussion).

Your program will go through the following steps:

a)Initialize an empty dictionary in the memory,

b)Create a loop, display the menu, and interact with the user (each menu option will call the appropriate function corresponding that menu option,

c)Continue displaying the menu (b) until the user selects Exit option,

d)Exit

Phase 2

1.Implement data persistence:

a.The program should load the data from a specific file (employee.dat) at startup and should save the data to the same file before shutdown.

b.At startup, if the file does not exist, then the program should initialize an empty dictionary in the memory and should not create a data file. If the file is read into memory, it should be immediately closed.

c.On exit, the dictionary, empty or not, should be written to the data file. If the file already exists, it should overwrite it, thus saving the latest state of the dictionary. The file should be immediately closed.

d.For reading and writing a binary file, you should use pickle module described in chapter 9.

e.Your program should have a function called load() that takes a string parameter with the filename and returns a dictionary unpickled from that file. If the file does not exist, then it should return an empty dictionary. The file should be closed before returning from this function.

f.Your program should have a function called save() that takes two parameters, a dictionary and a file. It should write the dictionary into this file using pickle module and close the file.

2.Implement find an employee by EID (option 3)

3.Implement Display Statistics option (option 5)

a.Statistics will include the number of employees in each department, as well as the total number of employees in the company.

Phase 3

1.Implement employee class and employee objects:

a.You should create a class called Employee. The main dictionary now will contain employee objects as values.

b.The file from Phase 2 will not work with this version, so you should delete the file and start from a new data file.

2.Add more information to Display Statistics option (option 5)

a.Statistics for each department should include the maximum, minimum, and average salary for that department. The same should be calculated and displayed for the entire company.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

Q: How much does Alpha-Gamma invest in training?

Answered: 1 week ago