Assignment 3
Working with composition
Submit before 11:30 Saturday May 9

Overview

For this assignment, you will continue practicing composition using the Company and Employee classes from lab 4.

Instructions, code writing and questions

  1. (from lab 4) Implement the load_companies function.
  2. (from lab 4) Test your load_companies function by assigning it to a variable and calling display_companies on it.
  3. Implement a method call fire_employee for the Compmany class. This method takes an employee ID (string) and removes the corresponding Employee object from the staff list. If the ID is not present, the method does nothing. Show that your method works.
  4. Write a function that reads from a file (e.g. sack_list.txt) that contains employee IDs. When given a list of company objects, it should fire the employees with the indicated IDs in the list of Company objects. Demonstrate that the function works. Note: you may choose details such as the name of the function, how the company list is loaded, etc.
  5. Write methods for the Company class so that it can be used to iterate through the employee objects. It involves adding a new class.

Deliverable

Create a text, word or pdf file that contains the following:

  1. A statement that summarizes your completion of the lab. The statement should include any help you received or whether you discussed your assignment with others. Keep in mind that you may not copy code from others or allow others to copy your code.
  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 doc file and your py files in a folder, zip it, and submit it on D2L. Check that your submitted zip file is complete.

Grading

The assignment is worth 6 points. Full credit will be awarded to complete, accurate and well presented submissions. Points will be deducted for the following:

  • Missing requirements
  • Inaccuracies (possibly excepting minor ones)
  • Poorly written explanations
  • Code constructs or style not used in class