Visit www.myprogramminglab.com to complete this Programming Challenge online and get instant feedback.  Payroll Class Exceptions Programming required you to write a Payroll class that calculates an...


Visit www.myprogramminglab.com to complete this Programming Challenge online and get instant feedback.


 Payroll Class Exceptions


Programming required you to write a Payroll class that calculates an employee’s payroll. Write exception classes for the following error conditions:


• An empty string is given for the employee’s name.


• An invalid value is given for the employee’s ID number. If you implemented this field as a string, then an empty string would be invalid. If you implemented this field as a numeric variable, then a negative number or zero would be invalid.


• An invalid number is given for the number of hours worked. This would be a negative number or a number greater than 84.


• An invalid number is given for the hourly pay rate. This would be a negative number or a number greater than 25.


Modify the Payroll class so that it throws the appropriate exception when any of these errors occurs. Demonstrate the exception classes in a program.



Nov 26, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here