Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Payroll Program: Create a Java application in NetBeans called Lab04 that creates an employee's paystub information. The program should first declare the constants as final

image text in transcribedimage text in transcribed

Payroll Program: Create a 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 "S" 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): * Program Name: Lab04 - Paystub Calculations * Program Description: This program calculates net paycheck information * Program Author: Kerry V. Cramer * Date Created: 02/10/2016 * Change Change Date Programmer Name Description Sample runs: Please enter number of hours worked in a pay period: 40 Please enter hourly pay rate: 10 Please enter federal tax withholding rate (e.g. 0.15): 0.15 Please enter state tax withholding rate (e.g. 0.045) : 0.10 Please enter number of hours worked in a pay period: 50 Please enter hourly pay rate: 10 Please enter federal tax withholding rate (e.g. 0.15): 0.15 Please enter state tax withholding rate (e.g. 0.045) : 0.10 * Paystub Information: * * Paystub Information: * Hours Worked: Pay Rate: Gross Pay: Deductions: 40.00 $10.00 $400.00 Hours Worked: Pay Rate: Gross Pay: Deductions: 50.00 $10.00 $550.00 Begin SOC_SEC_RATE= 0.06 retirement Plan Withheld = grossPay RETIREMENT_PLAN_RATE Output "Deductions - MEDICARE_RATE=0.01 UNION DUES RATE=0.01 retirementHealth Withheld = grossPay RETIREMENT HEALTH_RA RETIREMENT_PLAN_RATE = 0.02 Output Federal Tax & formatPercent fedTaxWithholdingRate) & & formatCurrency grossPay fedTaxWithholdingRate) RETIREMENT HEALTH RA TE-003 totalDeductions = fedTaxWithheld. state TaxWithheld + socSec TaxWithheld + medicareTaxWithheld + unionDues Withheld + retirement Plan Withheld + retirementHealth Withheld Input hours Worked netPay - grossPay totalDeductions Output - State Tax & formatPercent state TaxWit hholding Rate) & & formatCurrencylgrossPay* state Tax WithholdingRate) Input pay Rate Input Output fed TaxWithholding Rate Input state TaxWithholding Rate Output Social Security Tax ("& formatPercent SOC_SEC RATE) "& formatCurrency grossPay SOC_SEC_RATE) Output: hours Worked = 40 Output: " Retirement Health & formatPercent|RETIREME NT_HEALTH_RATE) & ": Outout ** Paystub Information grossPay (40 payrate) + hours Worked - 400 payRate 1.5) grossPay hours Worked payRate formatCurrencylgrossPay Output "Medicare Tax & formatPercent MEDICARE RATE) & & formatCurrency grossPay * MEDICARE RATE) RETIREMENT_HEALTH_RA Output TE) fedTaxWithheld = grossPay fedTaxWithholding Rate state Tax Withheld = grossPay Output: "Hours Worked: 3 hours Worked Output Union Dues & formatpercent/UNION_DU ES_RATE) & formatCurrency grossPay * UNION_DUES_RATE) Output: Total Deductons: "& formatCurrency totalDeduc tions state Tax withholding Rate socsecTaxWithheld = grossPay SOC SEC RATE netPay grossPay - totalDeductions Output: "Pay Rate:" & formatCurrency pay Rate) medicare TaxWithheld grossPay MEDICARE RATE Output "Retirement Plan & formatPercent RETIREME NT PLAN RATE) & ":" & formatCurrencylgrossPay Output: "Net Pay & formatCurrencyfnetPay) Output Gross Pay:" & formatCurrency hoursWor ked payRate) unionDues Withheld grossPay UNION DUES RATE RETIREMENT_PLAN_RATE End Payroll Program: Create a 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 "S" 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): * Program Name: Lab04 - Paystub Calculations * Program Description: This program calculates net paycheck information * Program Author: Kerry V. Cramer * Date Created: 02/10/2016 * Change Change Date Programmer Name Description Sample runs: Please enter number of hours worked in a pay period: 40 Please enter hourly pay rate: 10 Please enter federal tax withholding rate (e.g. 0.15): 0.15 Please enter state tax withholding rate (e.g. 0.045) : 0.10 Please enter number of hours worked in a pay period: 50 Please enter hourly pay rate: 10 Please enter federal tax withholding rate (e.g. 0.15): 0.15 Please enter state tax withholding rate (e.g. 0.045) : 0.10 * Paystub Information: * * Paystub Information: * Hours Worked: Pay Rate: Gross Pay: Deductions: 40.00 $10.00 $400.00 Hours Worked: Pay Rate: Gross Pay: Deductions: 50.00 $10.00 $550.00 Begin SOC_SEC_RATE= 0.06 retirement Plan Withheld = grossPay RETIREMENT_PLAN_RATE Output "Deductions - MEDICARE_RATE=0.01 UNION DUES RATE=0.01 retirementHealth Withheld = grossPay RETIREMENT HEALTH_RA RETIREMENT_PLAN_RATE = 0.02 Output Federal Tax & formatPercent fedTaxWithholdingRate) & & formatCurrency grossPay fedTaxWithholdingRate) RETIREMENT HEALTH RA TE-003 totalDeductions = fedTaxWithheld. state TaxWithheld + socSec TaxWithheld + medicareTaxWithheld + unionDues Withheld + retirement Plan Withheld + retirementHealth Withheld Input hours Worked netPay - grossPay totalDeductions Output - State Tax & formatPercent state TaxWit hholding Rate) & & formatCurrencylgrossPay* state Tax WithholdingRate) Input pay Rate Input Output fed TaxWithholding Rate Input state TaxWithholding Rate Output Social Security Tax ("& formatPercent SOC_SEC RATE) "& formatCurrency grossPay SOC_SEC_RATE) Output: hours Worked = 40 Output: " Retirement Health & formatPercent|RETIREME NT_HEALTH_RATE) & ": Outout ** Paystub Information grossPay (40 payrate) + hours Worked - 400 payRate 1.5) grossPay hours Worked payRate formatCurrencylgrossPay Output "Medicare Tax & formatPercent MEDICARE RATE) & & formatCurrency grossPay * MEDICARE RATE) RETIREMENT_HEALTH_RA Output TE) fedTaxWithheld = grossPay fedTaxWithholding Rate state Tax Withheld = grossPay Output: "Hours Worked: 3 hours Worked Output Union Dues & formatpercent/UNION_DU ES_RATE) & formatCurrency grossPay * UNION_DUES_RATE) Output: Total Deductons: "& formatCurrency totalDeduc tions state Tax withholding Rate socsecTaxWithheld = grossPay SOC SEC RATE netPay grossPay - totalDeductions Output: "Pay Rate:" & formatCurrency pay Rate) medicare TaxWithheld grossPay MEDICARE RATE Output "Retirement Plan & formatPercent RETIREME NT PLAN RATE) & ":" & formatCurrencylgrossPay Output: "Net Pay & formatCurrencyfnetPay) Output Gross Pay:" & formatCurrency hoursWor ked payRate) unionDues Withheld grossPay UNION DUES RATE RETIREMENT_PLAN_RATE End

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

What is missing from each fax?

Answered: 1 week ago