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

Problem: An employee is paid at a rate of $16.78 per hour for regular hours work

ID: 3889048 • Letter: P

Question

Problem: An employee is paid at a rate of $16.78 per hour for regular hours worked in a week. Any hours over that are paid at the overtime rte of one and one-half times that. From the worker's gross pay, 6% is withheld for Social Security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If worker has more than three dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the company pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input and that will then output the worker's gross pay, each withholding amount, and the net take-home pay for the week. IMPORTANT: FOLLOW GOOD PROGRAMMING STYLE/CONVENTION FOR NAMING ALL YOUR OBJECTS/VARIABLES. ADD COMMENTS ON TOP OF EACH METHOD AND AT TOP OF THE FILE (SEE EXAMPLE AT THE LAST PAGE)

Explanation / Answer

package javapractice;

import java.util.Scanner;

public class Worker {

public static void main(String[] args) {

int numberOfHours;

int numberOfDependency;

double grossPay=0;

double socialSecurityTax=0;

double federalIncomeTax=0;

double stateIncomeTax=0;

double healtInsurance;

double netTakeHome;

// TODO Auto-generated method stub

Scanner sc=new Scanner(System.in);

System.out.println("Enter number of houres wored ");

numberOfHours=sc.nextInt();

System.out.println("Enter number of Dependecy for the worker");

numberOfDependency=sc.nextInt();

//assuming 7 working days in a week and 8 hours as regular hours per day

if(numberOfHours>56)

{

grossPay=56*16.78+(numberOfHours-56)*1.5*16.78;//calculating gross pay for extra hours

}

else

{

grossPay=numberOfHours*16.78;

}

socialSecurityTax=grossPay*0.06;

federalIncomeTax=grossPay*0.14;

stateIncomeTax=grossPay*0.05;

if(numberOfDependency>3)

{

healtInsurance=45;

}

else

{

healtInsurance=10;

}

System.out.println("gross pay for the worker is "+grossPay);

System.out.println("social Security Tax is "+socialSecurityTax);

System.out.println("federal Income Tax is "+federalIncomeTax);

System.out.println("state Income tax is "+stateIncomeTax);

System.out.println("health Insurance is "+healtInsurance);

netTakeHome=grossPay-(socialSecurityTax+federalIncomeTax+stateIncomeTax+healtInsurance);

System.out.println("Net Take home is"+netTakeHome);

}

}

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