Question: For this lab you will modify your Lab 7 to make several improvements to the getter / setter methods. Instead of having them return True

For this lab you will modify your Lab 7 to make several improvements to the getter/setter
methods. Instead of having them return True/False, modify each one to throw an exception if
invalid data is passed.
Modify these methods in the following way:
add_hours(x)
o If the number of hours being added is less than 0, throw an exception. Do not
change how the hours are distributed if the number of hours added is greater
than 0.
set_employee_number(x)
o The employee number must be an integer. If the given input is not an integer,
throw an exception
set_office_number(x)
o If the office number given is less than 100 or greater than 500, throw an
exception.
set_name(x)
o If the given name is empty, throw an exception
o Any of the following characters should be removed from the name:
_,.,-(Underscore, period, and dash)
set_birthdate(m, d, y)
o If the given value for the month is less than 1 or greater than 12, throw an
exception
o If the given value for the day is less than 1 or greater than 31, throw a different
exception
You do not need to round or truncate your output. Name your class Worker

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!