Question
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.
Your program should include the following functions:
* One of which is called to get the Company Name up to 50 characters. No input just output.
* One of which is called to get the number of employees to process. No input just output.
* One of 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.0).
* One of which is called to calculate gross pay. It would require three parameters: hours worked, hourly rate, overtime pay, if any.
* One of 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 $1000 then 25% for amounts over $1000.
* The last function will be called to calculate the net pay. It requires 2 parameters, the gross pay and the federal tax.
Use the following calculations in your functions:
* overtime pay = (hours worked - 40.0) * hourly rate * 1.5
* federal tax = gross pay * .20
* and if gross pay > 1000 add to federal tax (gross pay 1000) * .05
The dialog with the user must be as follows: (the welcome message can be designed of your own choosing)
Welcome to the Smith Payroll Calculator
Enter the Company Name: ABC COMPANY
Enter the number of employees (1-10): 3
Enter the name for employee 1: John Smith
Enter the number of hours employee 1 worked: 40
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: Jim Brown
Enter the number of hours employee 3 worked: 36
Enter the hourly rate of employee 3: 15.20
Payroll Report
ABC COMPANY
-------------------------------
John Smith
Gross Pay: $ 1200.00
Federal Tax: $ 250.00
Net Pay: $ 950.00
Jane Doe
Gross Pay: $ 830.00
Federal Tax: $ 166.00
Net Pay: $ 664.00
Jim Brown
Gross Pay: $ 547.20
Federal Tax: $ 109.44
Net Pay: $ 437.76
Report Totals
-------------------
Gross Pay: $ 2577.20
Federal Tax: $ 525.44
Net Pay: $ 2051.76
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 number input for this program.
(0 <= employees <= 10; 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
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