Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am working on a lab. It is working, but not how I expected. I can't figure out how to put in the math work.

I am working on a lab. It is working, but not how I expected. I can't figure out how to put in the math work. Can you explain to me how?

Payroll Program:Java application in NetBeans called "Lab04" that creates an employee's paystub information.

The program should first declare the constants as "final doubles" for the following withholding rates:

SOC_SEC_RATE = 0.06;

MEDICARE_RATE = 0.01;

UNION_DUES_RATE = 0.01;

RETIREMENT_PLAN_RATE = 0.02;

RETIREMENT_HEALTH_RATE = 0.03;

Next, it should capture the employee's hours worked in a week, the employee's hourly pay rate, the federal tax withholding rate, and state tax withholding rate.Use the Scanner class in Java located in the java.util library (e.g. include this statement: import java.util.Scanner;).

The program should print out a "Paystub Banner", the employee's hours worked, hourly pay rate, gross pay, and then a "Deductions". This section indents two spaces and reports the Federal Tax, State Tax, Social Security Tax, Medicare tax, Union Dues, Retirement Plan, and Retirement Health withholding rates as a percent, the associated actual deductions, the Total Deductions, and the Net Pay.Gross pay should be calculated by multiplying the number of hours per week by the hourly rate.If the employee works more than 40 hours in a week, then the employee is paid at a rate of 1.5 times the pay rate for the hours above 40.Net Pay should equal the Gross Pay minus the total deductions.All dollar amounts should be preceded by a "$" and reflect two decimal places.You should use the printf method to format all dollar amounts so that they display accurately - including when you have 0 cents (e.g. $51.00).

Here is my work:

package lab04;

import java.util.Scanner;

/**

* To change the License Header, go to Project Properties and select License

Header

* To change the Template File, go to Tools and press Template and open it up

* /

/**

*

* @ Taylor R. DeNardo

*/

public class Lab04 {

public static void main(String[] args) {

final double SOC_SEC_RATE = 0.06;

final double MEDICARE_RATE = 0.01;

final double UNION_DUES_RATE = 0.01;

final double RETIREMENT_PLAN_RATE = 0.02;

final double RETIREMENT_HEALTH_RATE = 0.03;

Scanner input = new Scanner(System.in);

int number, number1, number2, number3;

System.out.println("Please enter number of hours worked in one pay period");

number = input.nextInt();

System.out.println("Please enter hourly payrate");

number = input.nextInt();

System.out.println("Please enter a federal tax withholding rate (e.g. 0.15:) ");

number = input.nextInt();

System.out.println("Please enter state tax withholding rate (e.g. 0.045) ");

number = input.nextInt();

System.out.println("*************************");

System.out.println("* Paystub Information *");

System.out.println("*************************");

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions