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 14:30
Norder to receive financial aid at his vocational school, mario must fill out the fafsa. the fafsa is a form that must be completed to determine . in order to complete a fafsa, you must submit . the fafsa can students obtain
Answers: 2
question
Computers and Technology, 23.06.2019 21:30
Write a fragment of code that reads in strings from standard input, until end-of-file and prints to standard output the largest value. you may assume there is at least one value. (cascading/streaming logic, basic string processing)
Answers: 3
question
Computers and Technology, 24.06.2019 16:30
You may see the term faq on websites which stands for frequently asked questions this is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation ken has dipped many dark chocolate marshmallows (which you remember the metric system distance units in decreasing order: kilometers, hectometer, decameter, centimeter, millimeter) is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation !
Answers: 1
question
Computers and Technology, 25.06.2019 12:00
What are the best ways to find data within a spreadsheet or database? check all that apply. sorting tools the function scrolling the search engine the search box
Answers: 1
You know the right answer?
Create a class called Payroll. Exception handling must be used. Solutions without exception handling...
Questions
question
Mathematics, 26.02.2021 01:00
question
Computers and Technology, 26.02.2021 01:00
question
History, 26.02.2021 01:00
question
Biology, 26.02.2021 01:00
question
Biology, 26.02.2021 01:00
question
Mathematics, 26.02.2021 01:00
Questions on the website: 13722360