Lab 2
Using classes
Submit after the end of the lab session

Overview

For this lab, you will continue practice of using a simple predefined class.

Instructions and questions

  1. Download the zip folder for the lab.
  2. Study the code in files demo.py and employee.py
  3. Run the demonstration functions in demo.py. Explain to yourself what they do and how they work.

Code writing

In order to write the functions below, start with the demo.py file and use those functions for suggestions to write the functions below. You should not modify the employee.py file for this lab.

  1. Write a function called get_employees that doesn't take any parameters. It should read the emprecords.txt file. With each employee record, it should create an Employee object and append it to a list. It should return the list.
  2. Write a function call give_raises. It should take one parameter: a list of Employee objects. The function should give them all raises!
  3. Write function called display_employees. It should take a list of Employee objects as a parameter, display all of them (use the method) and report the employee with the highest salary (display format is your choice).
  4. (optional) Write a function called give_select_raises. It should take a list of Employee objects as a parameter. Reading from raises.txt, it should give a raise (sometimes multiple times) to the object each time the employee id is presented in the file. This problem is not required for the lab, but will be required in the assignment.

Deliverable

Create a text (preferred) or pdf file that contains the following:

  1. A statement that summarizes your completion of the lab. As appropriate, the statement should include the following:
    • Who you worked with on the lab
    • Any difficulties you encountered
    • How you tested it (output can be provided at the end of your file)
  2. Your clearly labeled answers to explanations and questions
  3. A summary of the files included in the zip folder
  4. Demonstrations that show that your code works

Put your files in a folder, zip it and submit it under Lab 2 on D2L. Check that your submitted zip file is complete.

Grading

Your lab submission will be graded using the following rubric:

  • + .5 --- Your submission is clearly formatted.
  • + .5 --- Your submission includes a summary statement and includes how you collaborated.
  • + .5 / 1.0 --- You submitted most of the lab (0.5) or you submitted all of the lab (1.0).
  • + .5 --- Your lab submission is generally correct.