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 00:50
Is one of the most injurious events that can happen to a person in a crash.
Answers: 1
question
Computers and Technology, 22.06.2019 14:30
The “rule of 72” is used to approximate the time required for prices to double due to inflation. if the inflation rate is r%, then the rule of 72 estimates that prices will double in 72/r years. for instance, at an inflation rate of 6%, prices double in about 72/6 or 12 years. write a program to test the accuracy of this rule. for each interest rate from 1% to 20%, the program should display the rounded value of 72/r and the actual number of years required for prices to double at an r% inflation rate. (assume prices increase at the end of each year.)
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
The two main ways in which marketers address the competition with their strategies are by satisfying a need better than a competition and by
Answers: 2
question
Computers and Technology, 23.06.2019 06:00
Which statement is true of web-based social media? a.they allow consumers to interact with and update content. b.they cannot be updated easily, as compared to print media. c.they are expensive to produce and maintain, as compared to print and television. d.they can exist independent of the internet.
Answers: 1
You know the right answer?
Create a class called Payroll. Exception handling must be used. Solutions without exception handling...
Questions
question
Mathematics, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
question
English, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
question
English, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
question
Chemistry, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
question
English, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
question
History, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
question
Mathematics, 10.09.2020 23:01
Questions on the website: 13722363