Question: Create a Timesheet class with the following private instance variables .A variable for the employee's id number . A variable for their pay-rate A variable


Create a Timesheet class with the following private instance variables .A variable for the employee's id number . A variable for their pay-rate A variable for the number of hours they worked in a week. The Timesheet class should have public instance methods that 'set' and 'get' the three instance variables. Provide the set' method for payrate with logic that ensures that a value less than 7.25 is never set to it. Likewise, if the number of hours worked is set to less than zero, it should be reset to zero. Provide a constructor that sets all three variables. Make sure the constructor can't set payrate to less than 7.25 or hours to less than zero Also give the class a getWeeklyPay method that returns the total weekly pay based on the hours worked and the pay-rate. The method should account for overtime pay. Note that printing is not returning! The method does not print the answer -it returns it. Create a separate class with a main method. In that method instantiate an object of the Timesheet class using the constructor. Display the total weekly pay. Then modify the data in the existing Timesheet object using your set methods and once again display the total weekly pay Signal Loop package simplevalidatingloop import java.util.Scanner public class SignalLoop f public static void main(Stringl args) f Scanner sc = new Scanner(System.in); String goOn y'; while(goOn.equals(y) System.out.print(.Do you want to continue? goOn sc.nextLine) Enter".): System.out.println("Loop ended'); a Modo -manage your online data. Learn More Basic Validating Loop package simplevalidatingloop import java.util.Scanner, public class SimpleValidatingLoopt public static void main Stringl args) Scanner sc new Scanner(System.in) int data 1; while(data
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
