Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a class named Pay that includes five double variables that hold hours work

ID: 3622107 • Letter: W

Question

Write a class named Pay that includes five double variables that hold hours worked, rate of pay per hour, witholding rate, groos pay, and net pay. Create three overloaded computeNetPay() methods. When computeNetPay() receives values for hours, pay rate and witholding rate, it computes the gross apy and reduces it by the appropriate witholding amount to produce the next pay. (Groos pay is computed as hours worked multiplied by pay per hour.) When computeNetPay() receives two parameters, they represent the hours and pay rate, and the witholding rate is assumed to be 15%. When computeNetPay() receives one parameter, it represents the number of hours worked, the witholding rate is assumed to be 15%, and the hourly rate is assumed to be5.85. Write a main() method that tests all three overloaded methods. Save the application as Pay.java

Explanation / Answer

Dear, Here is the code class pay { double hours_worked; double ratePerHour; double withHoldingRate; double grossPay; double netPay; public void computeNetPay(double hrs,double payrate,double holdrate) { grossPay=hrs*payrate; netPay=grossPay-holdrate; System.out.println("Gross Pay: $"+grossPay); System.out.println("Net Pay: $"+netPay); } public void computeNetPay(double hrs,double payrate) { withHoldingRate=0.15; grossPay=hrs*payrate; netPay=grossPay-( withHoldingRate*grossPay); System.out.println("Gross Pay: $"+grossPay); System.out.println("Net Pay: $"+netPay); } public void computeNetPay(double hrs) { withHoldingRate=0.15; ratePerHour=5.85; grossPay=hrs*ratePerHour; netPay=grossPay-( withHoldingRate*grossPay); System.out.println("Gross Pay: $"+grossPay); System.out.println("Net Pay: $"+netPay); } } public class Demo { public static void main(String[] args) { pay pay1=new pay(); pay pay2=new pay(); pay pay3=new pay(); System.out.println("Employee 1:"); pay1.computeNetPay(10,10.5,5.6); System.out.println("Employee 2:"); pay1.computeNetPay(25,23.6); System.out.println("Employee 3:"); pay1.computeNetPay(32); System.exit(0); } } Hope this will help you

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote