Question
Changes from the basic are highlighted yellow Write a payroll processing program. Input will be from a file called weeklyData.txt. You may create this file
Changes from the basic are highlighted yellow Write a payroll processing program. Input will be from a file called weeklyData.txt. You may create this file on your own for testing purposes, but I have provided a file with 75 employees that I will use to test your code. (I know what it should produce). Each line in the file contains information about one employee. Each item is separated by a space. The items are, in order: First Name Last Name Hourly wage rate (decimal) Hours worked (decimal) # of dependents (whole number) % of gross withheld for retirement (whole number, ranges from 0 to 10) Amount donated to United Way (dollar amount) For each employee listed in this file, read the above data and produce the following detail data: Regular hours worked and overtime hours worked Regular pay and overtime pay and gross pay Pension contribution, United Way contribution Taxable income Insurance deduction, Income tax deduction Net pay Calculations: Overtime hours are all hours over 40, the rest are regular hours Regular pay is the regular hours times the wage rate Overtime pay is 1.5 times the overtime hours times the wage rate Gross pay is regular pay plus overtime pay Retirement is the percentage of the gross deducted from the employee, and the company will donate a matching amount up to $100.00. The matching amount is not added to the employees pay, or deducted from their pay. Just note this amount when you print the detail data for retirement. United Way contribution is whatever was read. Taxable income is gross minus both the retirement and united way contributions Insurance is determined by the number of dependents: 0 is $25.19 1 is $39.02 2 or more is $50.63 Income tax is calculated on taxable income as follows. The first $300 dollars is not taxed The next $500 is taxed at 8.5% of gross Everything over $800 is taxed at 12.5% of gross with the following stipulation: for each dependent, the tax rates (8.5 and 12.5) are reduced by %0.5 (a half of a percent). So, if a person has 2 dependents the rates would be %7.5 and %11.5
Net pay is gross pay minus the four deductions (retirement, united way, tax and insurance) The detail output should be to a file called payroll.txt formatted nicely, and include the three input values as well as all calculated values. Separate each employees detail data in the file as you see fit. Summary data should include the following (and should be printed at the end of the detail data in the output file, as well as to the screen. # of employees Total payroll (sum of all gross pay), and of that how much was overtime Total hours worked, and of that how many were overtime hours Total retirement contributions and total amount of matching funds Total United Way contributions Total insurance premiums Total taxes withheld
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started