Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi Everyone, Is anyone able to write a java code for this question? I attempted it but running into some issues during the calculation (see

Hi Everyone,

Is anyone able to write a java code for this question?

I attempted it but running into some issues during the calculation (see attached snipimage text in transcribedpet).

CSC108 - Introduction to Programming Lab 04: Payroll Program: Create a Java application in NetBeans called "Lab04" that creates an employee's paystub information. Begin The program should first declare the constants as "final doubles" for the following withholding rates: SOC_SEC_RATE=0.06 retirement Planwithelid RETIREMENT PLAN RATE Output "Deductions: MEDICARE RATE -0.01 SOC SEC RATE = 0.06; MEDICARE RATE = 0.01; UNION DUES RATE = 0.01: RETIREMENT PLAN RATE = 0.02; RETIREMENT HEALTH RATE = 0.03; retirement lealth withheld UNION_DUES_RATE=0.01 RETIREMENT_HEALTH_RA RETIREMENT PLAN_RATE = 0.02 Output - Federal Tax & formatPercent fedTaxWithholding Rate) 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:). RETIREMENT_HEALTH_RA formatCurrency grossPay fedTaxwholdingRate) Input hours Worked Output Input pay Rate totalDeductions 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 ns. All dollar amounts should be preceded by a "s and reflect two decimal places. You should use the printt method to format all dollar amounts so that they display accurately including when you have 0 cents (eg. $51.00). formatPercent state TaxWit hholding Rate formatCurrencylgrossPay state Taxwholding Rate Input fedTaxWithholding Rate state Tax Withholding Rate - Social Security Taxs formatPercent SOC_SEC RATE & -& formatCurrency grossPay SOC_SEC_RATE) hours Worked 40 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): Output - Retirement Health format percent RETIREME NT HEALTH RATE) & Output grossPay - 140 payrate + hours Worked . 40 paylate 1.5) grossPay hours Worked formatCurrency grossPay formatPercent MEDICARE RATE & & formatCurrencylgrossPay MEDICARE RATE) RETIREMENT HEALTH RA teda witheid 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 - ------- ------------ ------------------- --------------------- Sedaw Withholding Rate state Tax Withheld Output - Union Dues formatereenJUNION DU ES_RATE) 7-8 formatCurrency grossPay - UNION DUES RATE) "Total Deductions: & Currency totalDedue state TaxWithholding Rate Sample runs: SoeseeTaxWithheld grossPay net Paros SP "Pay Rate & formatCurrency paylate) Please enter under of hours worked in .pay period: 40 Please enter hourly pay rate: 10 Please antes federal tax withholding rate (e.g. 0.15): 0.15 Please enter atata tax withholding rate (2.9. 0.045): 0.10 Please enter under of hour worked in a pay period: 50 Please ente: hously pay zate: 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 medicare TaxWin held Output - Retirement Plan & formatPercent RETREME NT_PLAN_RATE) & & formatCurrency grossPay MEDICARE RATE Output "Net Pay & formatCurrencyjnetpay) Gross Pay" formatCurrency hours Wor Payatu RETIREMENT_PLAN_RATE Information: - Paystub Information: unionueshed UNION_DUES_RATE Hoa Worked 40.00 Pay Rate: $10.00 G-RY: $400.00 Deductions: Federal Tax (15.00): State Tan (10.08) : Social Security Tax 16.06): Medicare Tax (1.08) : Union Duna (1.00): Retirement Plan 12.00): Retirement Health (3.00): Total Daductions: $82.50 $55.00 $60.00 $40.00 $24.00 $4.00 HOUES Worked 50.00 Pay Rate: $10.00 GEDAR Pay: 6550.00 Deductions: Federal Tax (15.00): state Tan (10.0L) : Social Security Tax (6.06): Medicare Tax (1.00): Union Dues (1.00): Retirement Plan 12.00): Retirement Health (3.0L) : Total Deductions: $8.00 $12.00 5252.00 $5.50 $5.50 $11.00 $16.50 $209.00 Net Pay: $248.00 Net Pay: 5341.00 Zip the Lab04 folder. Rename the zip file to "Your Name Lab04.zip" (e.g. Joe Student Lab04.zip), and send it to me as an attachment in Blackboard. Flowchart: See below. Follow the connectors for the complete flowchart. Note: The Visual Logic tool that generated the flowchart does not have a printf equivalent, so the formatting was done using its own tools). RA

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

Students also viewed these Databases questions