Next February 2001 Slide #52

Lab 7


  1. Perform the empty subclass test on your Person class. If it fails, fix the class.

  2. Write a program that reads the HTML files named in its command-line arguments. For each file, it should print out the text contained in the file's <H1>, <H2>, <H3>, <H4>, <H5>, and <H6> elements. Then test it.


  3. Implement an Employee class that inherits from Person. It should also have department and boss member data, with appropriate accessor methods.


  4. Create a subclass of Employee called Manager. Manager has an additional member data, team, which is a list of other employees who are supervised by this manager. team should not be directly modifiable; instead, there should be two methods, team_add and team_remove, which add or remove a specified employee from the manager's team. There should also be a team method which returns the list of employees in the current team.

    Modify the Employee::boss accessor so that it automatically updates the boss's team data for any employee who has a boss.

  5. If you have time, add a new method, perform_task, to your Employee class. If the target object is a regular Employee, then perform_task should take a string argument and print out

            <Employee name>: I am staying late today to work on <...>.
    

    But if the employee is a manager whose TEAM data is nonempty, it should instead select a team member at random, print

            <Manager's name>: <Subordinate's name> will take care of this
                              while I play golf.
    

    Then it should delegate the perform_task call to the employee it has chosen.



Next Copyright © 2001 M-J. Dominus