Ask C/C++ Expert


Home >> C/C++

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

/* --------------------------- */

/* 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)

}

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M91381099
  • Price:- $50

Guranteed 36 Hours Delivery, In Price:- $50

Have any Question?


Related Questions in C/C++

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As