Program that determines the gross pay and net pay

Assignment Help C/C++ Programming
Reference no: EM13811146

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: ***** ***** 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.

#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)

}

Reference no: EM13811146

Questions Cloud

About public speaking : public speaking
Index of the ability to pay taxes than income : Explain why many economists argue that an income tax penalizes savers but a consumption tax would not. In what sense can consumption be regarded as a better index of the ability to pay taxes than income?
Impropriety and resulting effect to stakeholder confidence : Assess the impact to the company's financial performance based on the impropriety and the resulting effect to stakeholder confidence in management, recommending how the company can minimize the resulting impact to the business.
How would you address the difficulties of social work : Which characteristics of an effective helper did the social worker display. What factors influence the use of her skills
Program that determines the gross pay and net pay : 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
Calculate the value of the output voltage : Calculate the value of the output voltage, Vout, in the circuit in Figure 8-1 below. Take care this circuit has a dependent source in it.
Explain shintoism and zoroastrianism : Shintoism and Zoroastrianism
Formal and informal commuinication methods : Describe both the formal and informal commuinication methods within the organization. Address whether or not the organization uses effective communication techniwues.
Show the items by zone or location within the store : There is other information. Some people shop on a budget so they need the price and the sale price. Use an array or vector to hold the list of items. The display should show the items by zone or location within the store. (Display the output by loc..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd