Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started