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

Write complete program for the following problem and compile and run and make su

ID: 3732459 • Letter: W

Question

Write complete program for the following problem and compile and run and make sure that the program works correctly Weekly Payroll. Write a Java program to create a weekly payroll using the following Tax Guide Your program should request the following information: employee id number (integer), hourly wage, hours worked per week, number of withholding exemptions, marital status (use a code 0 and 1 or m and s) and previous year-to-date earnings Program should then use a loop to process information for each employee until -1 entered for the employee id number. After data has been read, it should calculate and display the following information: employee id number, current earning, current year to date earnings (after current earnings is added), FICA taxes, Income tax withheld, and take home check amount. The above items should be calculated as follows hourly wage times hours worked (with time and a half after 40 hours) Current earnings: Year-to-date earnings: Previous year-to-date earnings plus current earnings sum of 6.2% of the current earnings for the week (Social Security benefits Tax) and 1.45% of the current earnings for the week (Medicare tax). FICA tax: Federal income tax withheld: Subtract $51.92 from the current earnings for each withholding exemptions and use this adjusted weekly income and the following tables depending on the marital status. Take home pay: current earnings - FICA taxes-Federal income tax withheld Table 1: Federal income tax withheld for a single person paid weekly Adjusted Weekly Income $0 to $51 Over $51 to $517 Over $517 to $1,105 Over $1,105 to $2,493 Over $2,493 to $5,385 Over $5,385 Income Tax Withheld $0 15% of the amount over S51 $69.90 + 28% of excess over $517 $23454 +31% of excess over $1,105 $664.82 + 36% of excess over $2.493 $1,705.94 + 39.6% of excess over$5,385

Explanation / Answer

ANS:-

Given that ,

We should write a program for the following problem and compile and run and make sure that the program works correctly Weekly Payroll. Write a Java program to create a weekly payroll using the following Tax Guide Your program should request the following information: employee id number (integer), hourly wage, hours worked per week, number of withholding exemptions, marital status (use a code 0 and 1 or m and s) and previous year-to-date earnings Program should then use a loop to process information for each employee until -1 entered for the employee id number. After data has been read, it should calculate and display the following information: employee id number, current earning, current year to date earnings (after current earnings is added), FICA taxes, Income tax withheld, and take home check amount. The above items should be calculated as follows hourly wage times hours worked (with time and a half after 40 hours) Current earnings: Year-to-date earnings: Previous year-to-date earnings plus current earnings sum of 6.2% of the current earnings for the week (Social Security benefits Tax) and 1.45% of the current earnings for the week (Medicare tax). FICA tax: Federal income tax withheld: Subtract $51.92 from the current earnings for each withholding exemptions and use this adjusted weekly income and the following tables depending on the marital status. Take home pay: current earnings - FICA taxes-Federal income tax withheld Table 1: Federal income tax withheld for a single person paid weekly Adjusted Weekly Income $0 to $51 Over $51 to $517 Over $517 to $1,105 Over $1,105 to $2,493 Over $2,493 to $5,385 Over $5,385 Income Tax Withheld $0 15% of the amount over S51 $69.90 + 28% of excess over $517 $23454 +31% of excess over $1,105 $664.82 + 36% of excess over $2.493 $1,705.94 + 39.6% of excess over$5,385 .

PROGRAM:-


import java.util.Scanner;
public class PayrollCalc
{
private String name;
private double hoursWorked;
private double hourlyPayRate;
private static final double FEDERAL_TAX_WITHHOLDING_RATE = 0.20;
private static final double STATE_TAX_WITHHOLDING_RATE = 0.09;

public PayrollCalc()
{

}
public PayrollCalc(String n, double hw, double hpr)
{

this.name = n;
this.hoursWorked = hw;
this.hourlyPayRate = hpr;
}
public double grossPay(double hourlyRate, double hrsWorked)
{
double grossPay = (hourlyRate * hrsWorked);
return grossPay;
}
public double federalTax(double gross)
{
return FEDERAL_TAX_WITHHOLDING_RATE * gross;
}
public double stateTax(double gross)
{
return STATE_TAX_WITHHOLDING_RATE * gross;
}

public String getName()
{
return name;
}
public void setName(String name) {
this.name = name;
}
public double getHoursWorked() {
return hoursWorked;
}
public void setHoursWorked(double hoursWorked) {
this.hoursWorked = hoursWorked;
}
public double getHourlyPayRate() {
return hourlyPayRate;
}

public void setHourlyPayRate(double hourlyPayRate) {
this.hourlyPayRate = hourlyPayRate;
}
}
import java.util.*;
public class PayrollDriver
{
public static void main(String args0)
{
Scanner input = new Scanner(System.in);
Scanner input = new Scanner(System.in);
PayroliCalc data = new PayroliCalc();
Systern.out. printInCEnter your name: ");
data.setName(input.next());
System.out.println("Number of Hours Worked: ");
data.setHoursWorked(Double.parseDouble(input.next()));
System.out.println("Hourly Pay Rate: ");
data.setHourlyPayRate(Double.parseDouble(input.next()));
double grossAmount = data.grossPay(data.getHourlyPayRate(), data.getHoursWorked());
System.out.printin();
System.out.printInC "....................");
System.out.println("Name: + data.getName());
System.out.println("Hours Worked: "+ datagetHoursWorked() + "hrs.);
System.out.printin("Pay Rate: $" + data.getHourlyPayRate());
System.out.println("Gross Pay: $. + grossAmount + 'In.);
System.out.printinCDEDUCTIONS");
System.out.printinffederal Tax Withholding (20,4: $. + data.federalTax(grossAmount)); System.out.printineState Tax Withholding (9%): $. + data.stateTax(grossAmount)); System.out.println("Total Deductions: $" + (data.federalTax(grossAmount) + data.stateTax(grossAmount))); Systern.out.printineNet Pay: $. + (grossAmount - (data.federalTax(grossAmount) + data.stateTax(grossAmount))));
input.close();
}
Output :-
Name: shiny Hours Worked: 40.0 hrs
Pay Rate: $6.75
Gross Pay: $270.0
DEDUCTIONS
Federal Tax Withholding (20%): $54.0
State Tax Withholding (9%): $24.3
Total Deductions: $78.3
Net Pay: $191.7

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