# Writing a C program for Employee Payroll System

Do you want a similar Paper? Click Here To Get It From Our Writing Experts At A Reasonable Price.

Writte 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: ***** ***** Enter the number of hours for ***** *****: 40 Enter the hourly rate for ***** *****: 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 —————————— ***** ***** 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 Cher 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: The coral text represents the “output” from your program and is shown for clarity only here. It is not required that your output be in this color. (Do not even attempt to try!). Also note that what the user types in is indicated by the blue area above. Again, for clarity only. 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. (1 <= employees 0)  Also, arrays are needed in this program, and functions are required as stated.  This program cannot be submitted late, because the last day of the course is the last chance to submit programs. Submit whatever you have on that date to avoid a zero on the assignment. Good luck!

This what I have tried so Far please kind of use the below template to complete answer:

#include<stdio.h>

/* ————————— */

/* Declare Function Prototypes */

/* ————————— */

float calc_ot_pay  (float, float);

float calc_fed_tax (float);

float calc_net_pay (float, float);

void print_payroll(char [],char [][30], float [], float [], float [], int , float , float , float );

/* ——————- */

/* Begin Function Main */

/* ——————- */

main()

{

/* ——————— */

/* Variable Declarations */

/* ——————— */

int     x,  how_many;

char    emp_name[10][30] = {” “}, comp_name[30];

float   hours_worked[10], hourly_rate[10];

float   gross_pay[10], federal_tax[10], net_pay[10], overtime_pay;

float   gross_pay_total=0, federal_tax_total=0, net_pay_total=0;

/* ————————————————– */

/* Prompt the user for number of employees            */

/* ————————————————-  */

printf (“\nWelcome to the Payroll Calculator\n\n”);

printf (“Please enter Company Name: “);

gets(comp_name);

fflush(stdin);

} /* end main */

/* ————————– */

/* Begin function calc_ot_pay */

/* ————————– */

float calc_ot_pay(float hr, float hw)

{

float overtime_pay;

overtime_pay = ( (hw – 40) * hr * 1.5 );

return overtime_pay;

} /* end calc_ot_pay */

void print_payroll(char comp[],char emp_name[][30], float gross_pay[], float federal_tax[], float net_pay[],

int how_many, float gross_pay_total,    float net_pay_total, float federal_tax_total)

}

Do you want a similar Paper? Click Here To Get It From Our Writing Experts At A Reasonable Price.

## One thought on “Writing a C program for Employee Payroll System”

1. What’s up,after reading this remarkable poece of writing i am
also glad to share my familiarity here with friends.