Question: class Department: Create a class called Department. A department should have the following four attributes: 1 . department _ name: the name of the department.
class Department:
Create a class called Department. A department should have the following four attributes:
departmentname: the name of the department.
capacity: a constant value to indicate the maximum number of employees that this department can
hire.
roster: a list that holds all of the employee objects who work in this department.
Tasks:
Add constructor.
Add a get method for each attribute.
Add a method called adde that can add an employee can be a regular Employee, an
HourlyPaidEmployee, or an Executive to the department. Assign this department to the employee
objects department attribute. Raise IndexError if the number of employees has exceeded maximum
capacity for the department. Update this information in the dictionary, employees.
Add a method called transferdept e that can transfer the given employee e to the specified
department. If the other department has reached its capacity limit then raise IndexError. If the given
employee is not in the department, then raise ValueError. Update this information in the dictionary,
employees.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
