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, 22.06.2019 20:00
Amanda needs to create an informative print brochure for her local library’s fundraiser dinner. what critical detail must she have before she starts designing the brochure?
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
Jason works as an accountant in a department store. he needs to keep a daily record of all the invoices issued by the store. which file naming convention would him the most? a)give the file a unique name b)name the file in yymmdd format c)use descriptive name while naming the files d)use capital letters while naming the file
Answers: 3
question
Computers and Technology, 23.06.2019 03:00
Your business be in google top rank.more the rank more the business leads.for best seo and digital marketing services be confident to contact you can get best seo solutions by assistance experts provide digital marketing, website development, seo expert services and social media internet seo expert services your branding solutions. seo expert services ,best seo expert services,online seo expert services,
Answers: 3
question
Computers and Technology, 23.06.2019 15:00
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a.an advanced knowledge of physics and math b.an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 1
You know the right answer?
Create a class called Payroll. Exception handling must be used. Solutions without exception handling...
Questions
question
Mathematics, 31.05.2020 15:57
question
Mathematics, 31.05.2020 15:57
Questions on the website: 13722359