Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

I am working on a lab. It is working, but not how I expected. Am I doing something wrong?

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

Here is the assignment:

CSC108 - Introduction to Programming

Lab 04:

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" (see example run below), 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).

Also, please use the "t" (tab) escape sequence to format your output. To print a "%", you should enter two (e.g. "%%"). Your output should be formatted exactly as the example run below and your calculations should be accurate to the penny. You must use variable names and constant names that conform to the naming conventions discussed in the text book. Also, please include block comments, line comments, and a program header documentation block.  Below is an example (Of course, you would replace my name with your name as Program Author):

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("*************************");

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question