Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program named PayStub (file name: PayStub.java) to compute and print an employees weekly gross pay, withholdings (deductions) and net pay. Your program will

Write a program named PayStub (file name: PayStub.java) to compute and print an employees weekly gross pay, withholdings (deductions) and net pay. Your program will prompt the user to enter the employees name, company name, title, pay period, pay rate, and hours worked. After computing the gross pay and all the withholdings (deductions) your program will print the gross pay, net pay, and all the deductions. The output of your program should look similar to the following: Jane Q. Public Customer Service Specialist ACME Corporation, Inc. Pay period: 6/6/2017-6/12/2017 Pay rate: 12.00 Hours per week: 48.5 Gross Pay: 633.00 Regular Pay: 480.00 Overtime Pay: 153.00 Net Pay: 483.29 Total Deductions: 149.71 Federal: 63.30 State: 37.98 Social Security: 39.25 Medicare: 9.18 Implementation Details: All statements should be defined in the main method of the class (except for declarations of constants). The following are the requirements: Declare a String variable named employeeName to store the employee name and the prompt should be Enter Employee Name: . Use a variable named employeeTitle to store the employees title and the prompt to get the title should be Enter Employee Title: . The String variable companyName stores the name of the company and the prompt should be: Enter Company Name: . The prompt for the pay period is Enter Pay Period: and the pay period is stored in a String variable named payPeriod. A variable payRate should be declared to store the employees hourly wage rate (dollars per hour) and the prompt to get the user input for the pay rate should be: Enter Pay Rate: . Similarly, the prompt Enter Hours Worked: should be used to get the hours per week. A double variable hoursWorked should be used to stores the hours worked. The fraction part of hours worked can only be in the increments of 15 minutes which are .0, .25, .5 and .75. If the user enters a fraction that not in the increments of 15 minutes then round it up to the next 15 minutes. So, if the user enters hours work to be 51.39 then it should be rounded up to 51.5. In such a case print a message on the screen: Hours worked rounded up to 51.5. Any hours worked over the regular 40 hours is considered overtime and the overtime hours are paid at a rate of hour and a half of the employees regular pay rate. Define a named constant as follows and use this named constant instead of hardcoded value of 1.5 (for hour and a half) in computing overtime pay in your code: final double OVERTIME_RATE = 1.5; Define named constants for the federal tax rate percent, the state tax rate percent, the social security tax rate percent, and the medicare tax rate percent with the following values: FEDERAL_TAX_PERCENT: 15.0. STATE_TAX_PERCENT: 6.0. SS_PERCENT: 6.2. MEDICARE_PERCENT: 1.45. Declare variables of type double named federalTax, stateTax, ssTax, and medicareTax to hold the computed values of withholding (deductions) for the federal, state, social security, and medicare taxes. Use Javas Scanner class to get the keyboard from the user. All double value (as shown in in a sample output) should be printed two places after decimal. You can use Javas formatted output statements such as printf along with escape sequences such as \t to format the output. You may have to do some trial and error to properly format your programs output to match the output shown above. Test your program with various input values of pay rate and hours worked. Make sure that the input prompts and the out has the proper format with exact text, spacing and indentation. Make sure that your program compiles and does not generate run-time error. Save your Java program file as PayStub.java

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

Recommended Textbook for

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

What were the reasons for your conversion or resistance?

Answered: 1 week ago