Question: - Constructor: Receives: - Last name. - First name. - Hourly salary. - Methods: .get() method for each instance variable. .set() method for each instance


- Constructor: Receives: - Last name. - First name. - Hourly salary. - Methods: .get() method for each instance variable. .set() method for each instance variable. .toString() method that displays employee's information on one line: - Information will be within square brackets. Method to determine employee's weekly salary: - Method: - Will receive the number of hours worked during the week as an input parameter. - Method will return weekly salary to calling method. Test program will perform the following tasks: - Allow user to input last name, first name and weekly salary. - Set up an Employee object. - Display employee's information using Employee's .toString() method. - Allow user to input number of hours employee worked during current week. - Call method to determine employee's salary for week; This value will be printed in main() upon return from method. NOTE: You do not need to use .get()/set() methods in your test program but they must be included in the class. A run of the program might look like the following: ...-jGRASP exec: java Employee_Test_Jerkofsky Enter employee data: Last name: Jones First name: Jim Hourly salary: $15.25 Employee \#1: [Jones; Jim; \$15.25] Nr hours worked: 32.5 Employee \#1's weekly check: $495.63 ...jGRASP: operation complete. One additional concern: - When initially calculating the employee's weekly salary, there's a good chance that the value will not have just 2 decimal places (in the example code, the weekly salary would be $495.625 ); since this is a dollars and cents amount, we need to modify the value returned so there are only two digits to the right of the decimal place. To do this, you can use the following coding concept: [from https://stackoverflow.com/questions/5710394/how-do-i-round-adouble-to-two-decimal-places-in-java ] 59 double number =651.5176515121351 number = Math. round ( number * 100); number = number /100; The output will be 651.52
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
