subject

Create a class called Payroll. Exception handling must be used. Solutions without exception handling will get zero credits. Here is the information for the class Instance variables are the name of the employee, the hours person worked and the hourly rate. Include the following methods • Constructor: accepts the name, rate and the hours worked. Make sure to use throws Exception if the parameters are invalid. rate and hours worked cannot be negative and the name of the person cannot be empty. create an Exception object with the proper message. look at the sample output for the proper exception message • setter methods for all the instance variables. : make sure to use throws Exception if the parameters are not valid o setName: name cannot be empty string o setHours: the parameter to this methods cannot be negative o setRate: the parameter to this method cannot be negative • calculatePay: calculates the money that the person earned and returns it. The money earned can be calculated by rate * hours Driver class: must use try catch, and while loop, no if/else statements otherwise zero credit will be given. . prompt the user for the name, rate, hours • create the object using the constructor, if the object cannot be created then must ask the user for the info all over again. call the method calculate pay . Sample output: Enter the name: Jose Enter the hours: -12 Enter the rate: 12 Hours cannot be less than zero We have to start all over again Enter the name: Jose Enter the hours: 12 Enter the rate: -5 rate cannot be zero or negative We have to start all over again Enter the name: Jose Enter the hours: 12 Enter the rate: 12 Your pay is : 144.0

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 03:00
What are the different parts of computer
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
20 points archie wants to use a reflector as he photographs a newlywed couple. what would he consider in his choice? a. shadow and sunny b. homemade and professional c. lamps and boards d. incident and reflected e. neutral density and enhancement
Answers: 3
question
Computers and Technology, 24.06.2019 02:30
How to apply the fly in effect to objects on a slide
Answers: 1
question
Computers and Technology, 24.06.2019 22:00
Aobject is used for displaying the results of a question based on stored data. a. query b. report c. table d. form
Answers: 2
You know the right answer?
Create a class called Payroll. Exception handling must be used. Solutions without exception handling...
Questions
question
Chemistry, 10.02.2021 18:20
question
Geography, 10.02.2021 18:20
question
Mathematics, 10.02.2021 18:20
Questions on the website: 13722363