Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program that determines the gross pay and net pay for each of n employees, then prints out a payroll summary report. For

Write a C program that determines the gross pay and net pay for each of n employees, then prints out a payroll summary report. For each employee, your program should prompt for the number of hours worked and the hourly rate of the worker. Once this information is entered, your program should calculate the gross pay, federal tax paid, and net pay for that employee. The company pays straight-time for the first 40 hours worked by each employee, and pays time-and-a-half for all hours worked in excess of 40 hours. Use data type float for all values except loop variables. Your program should include the following functions(appropriately named): Function 1 which is called to get the Company Name up to 30 characters. Function 2 which is called to get the number of employees to process. Lets set a maximum of thirty employees as a maximum. Function 3 which is called to determine the overtime pay. It would require 2 parameters passed to it (hourly rate, and hours worked), both of which are data type float. It would return the calculated overtime pay (as shown below), which is of data type float. This function should only be called if necessary (that is, when the number of hours worked is more than 40). Function 4 which is called to calculate gross pay. It would require three parameters: hours worked, hourly rate, overtime pay, if any. Function 5 which should be called to calculate the federal tax. It requires 1 parameter passed to it (gross pay), and should return the federal tax paid, both of which should be data type float. Assume that federal tax is 20% of gross pay up to $999.99 then 25% for amounts over that. The last, Function 6 will be called to calculate the net pay. It requires 2 parameters, the gross pay and the federal tax. The dialog with the user must be as follows: (the welcome message can be designed of your own choosing) Welcome to the Sears Payroll Calculator

Enter the Company Name: Acme House Painting

Enter the number of employees(1-10): 3 Enter the name for employee 1: John Smith Enter the number of hours employee 1 worked: 36 Enter the hourly rate of employee 1: 30.00

Enter the name for employee 2: Jane Doe Enter the number of hours employee 2 worked: 41 Enter the hourly rate of employee 2: 20.00

Enter the name for employee 3: Sally Post Enter the number of hours employee 3 worked: 30 Enter the hourly rate of employee 3: 15.20

Payroll Report Acme House Painting ------------------------------- John Smith Gross Pay: $ 1080.00 Federal Tax: $ 270.00 Net Pay: $ 810.00

Jane Doe Gross Pay: $ 850.00 Federal Tax: $ 170.00 Net Pay: $ 680.00

Sally Post Gross Pay: $ 456.00 Federal Tax: $ 91.20 Net Pay: $ 364.80

Report Totals ------------------- Gross Pay: $ 2386.00 Federal Tax: $ 531.20 Net Pay: $ 1854.80

Note: The bold black text represents the "output" from your program what the user types in is indicated by the blue text above. It may not appear so, but I want the decimal places to be aligned for the Payroll Report. Hints: Error checking is required on all number input for this program. (0 <= employees <= 20; rate, hours > 0) Also, arrays are needed in this program. Structs are not required, but can be used if you wish.

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

More Books

Students also viewed these Databases questions