Improving the Grade Book with a Dictionary
For this Lab, you will use everything you have learned in this class to create an Employee Database. The Employee Database will contain the names of employees, their Salaries, their job Titles, their home Address, and their Contact info [MUST HAVE “John Appletree and Chief Information Officer for John’s Title]. There is one catch: The employee Database WILL be a second file that is imported into the file you use to edit the database. So to recap, you will create a file, named EmployeeDatabase.py that contains the Employee Database. You will create a second file called EmployeeDirectory.py that provides the user with the ability to read any item contained in the Employee Database. You are free to use whichever method you want, but you DO NOT need to save anything to a file. NOTE: I will provide 10 extra credit points if you save the database to a file (Excel, JSON, etc) as well-formatted. Do not use a text file, as you have seen this can be a problem. Functions and Files:
- File named EmployeeDatabase,py
- only required to have one function that holds the database in whatever form you want: list, dictionary, JSON, XML
- This function, named below, will check if the name is in the database and return the value to the calling function in EmployeeDirectory.py
- If you choose to use a file, you will first need to open the file, search it for the persons name, then return the key:value pairs to the calling function. The external file will only hold the Employee names and their respective attributes, you still need the EmployeeDatabase.py file to search for the value and return it to the EmployeeDirectory.py file.
- Ensure you have the name “John Appletree” in your database with the following Title – Chief Information Officer.
- File named EmployeeDirectory.py
- Need to have a function that welcomes the user and determines if they wish to print a specific part of the database. All you need to do is print the value associated with the field requested by the user. For instance, if I want to print out Andy’s salary, it should only print the number associated with his salary. The function can be called Menu(). This function will call the companyRegistry() function that is contained in the EmployeeDatabase.py file. Also, I would suggest using a try: catch block and putting that in a while loop. This way you can make sure the user inputs a persons name and not some other data type without crashing your program.
- I will deduct 30 points if you fail to create two files, one for the database and one for the editor.
- I will deduct 50 points if your program does not run
- I will deduct 20 points if you fail to get the database to print
- I will add 10 points if you save the database to a file
Additional Resource: Please review this site to see how to implement a database using a dictionary, should you choose to do it that way.https://developer.rhino3d.com/guides/rhinopython/python-dictionary-database/