Question: Java Program: Create a text file to hold the data and read the data from the file, and write the stubs to a file. Handle

Java Program: Create a text file to hold the data and read the data from the file, and write the stubs to a file. Handle overtime hours (pay the rate * 1.5 for the hours over 40).

1. Given the data name and hours worked, calculate gross pay, taxes, and net pay. Display a pay stub.

1.1 Given:

Cody_Smith, 44.5 hours, (assume payrate is $8.50)

Display:

_____________________________________________

Cody_Smith Gross: $378.25

Taxes(25%): $94.56

Net: $283.69

_____________________________________________

1.2 Given:

Dawn_Brown, 37.5 hours, 9.50 payrate

Display:

_____________________________________________

Cody_Smith Gross: $356.25

Taxes(25%): $89.06

Net: $267.19

_____________________________________________

2. Write the following methods(note: getGross is overloaded- overloading is required):

Return Type

Name

Parameters

double

getGross

double workHours

double

getGross

double workHours, double payRate

double

getTaxes

double grossPay

double

getNet

double grossPay, double taxes

void

printPayStub

String name, double grossPay, double taxes, double netPay

3. Main method

Public static void main method:

declare variables for grossPay, taxes, netPay

declare variables for name, hoursWorked, payRate

declare a loop variable (e.g. Boolean goAgain= true)

while goAgain is true

get data for one employee from console, if no payrate, enter 0.

call the getGross method assign the return value to grossPay

call the getTaxes method assign the return value to taxes

call the printPayStub method

ask user if they want to enter another employees data (update goAgain)

end while loop

4. Write 5 methods indicated above

5. Use loop to control each employees entry

6. Complete the data entry and calculations (function calls) for gross, taxes, net

7. Call the printPayStub method- output formatted below.

_____________________________________

Employee Name: Cody Smith

Gross Pay: $xxx.xx

Taxes Paid: $xxx.xx

Net Pay: $xxx.xx

_____________________________________

8. Handle the following input:

Cody_Smith, 44.5

Dawn_Brown, 37.5, 9.50

Tony_Casper, 38

Jane_Simmons, 50, 8.25

Clyde_Key, 35, 17.50

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!