C program for Employee Payroll System - 69493

Solution Posted by


Rating : (19)A+
Solution Detail
Price: $10.00
Request Description

Write a C program that determines the gross pay and net pay for each of up to


ten 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.


Gross pay is calculated by: hours worked * hourly rate, plus overtime pay, if any.


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 at least four functions. 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).


The second function 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 a % of gross pay (as


shown below).


The net pay can then be calculated (gross pay - federal tax) and returned by a


third function.


Use the following calculations in your functions:


 overtime pay = (hours worked - 40.0) * hourly rate * 1.5


 federal tax = gross pay * .2 if gross pay is under 1000, and otherwise federal


tax = gross pay * .22


The last function takes the data amassed in the arrays, and prints out the payroll


report as shown below.* (If you cannot accomplish the last function, submit


without this function for a -5 deduction).


The dialog with the user must be as follows: (the welcome message can be


designed of your own chosing)




Please enter the name of your company: ACME


Welcome to the ACME Payroll Calculator


Enter the number of salaries to process(1-10): 3


Enter the name for employee 1: John Smith


Enter the number of hours for John Smith: 40


Enter the hourly rate for John Smith: 10.00


Enter the name for employee 2: Jane Doe


Enter the number of hours for Jane Doe: 41


Enter the hourly rate for Jane Doe: 20.00


Enter the name for employee 3: Cher


Enter the number of hours for Cher: 36


Enter the hourly rate for Cher: 15.20


ACME Payroll Report




John Smith


Gross Pay: $ 400.00


Federal Tax: $ 80.00


Net Pay: $ 320.00


Jane Doe


Gross Pay: $ 830.00


Federal Tax: $ 166.00


Net Pay: $ 664.00




Gross Pay: $ 547.20


Federal Tax: $ 109.44


Net Pay: $ 437.76


Report Totals




Gross Pay: $ 1777.20


Federal Tax: $ 355.44


Net Pay: $ 1421.76


Note: It may not appear so, but I wish


the decimal places to be aligned for the Payroll Report.


Hints/Notes:  Error checking is required on all user input except for names for this


program. (10)


? Also, arrays are needed in this program, and functions are required as



Solution Description

C program for Emplo