Payroll Program

Hello :) I need help with a payroll program.
These are the requirements in the program:

Use non-returning functions with parameters
Write a program that will accept the following info and compute for the employee payroll.
·         Employee code
·         Hourly rate of pay
·         Number of hours worked
·         Tax percentage to be deducted.

Gross pay is computed by multiplying the hourly rate and the number of hours worked.
Net Pay is gross pay less tax

The program requires the following functions:
1. void function called instructions to display to the user what to do or what to input
2. void function called heading to display the heading in red color.
3. void function with parameters to display employee information such as employee code, hourly rate, hours worked, taxrate, grosspay and netpay.

Example:
Employee Code: 200860123
Hourly Rate: 10.45
Number of hours Worked: 40
Tax Rate: 15% or 0.15
Gross Amount:418.00
Net Amount: 355.30

I need help to correct my codes :(


Thank You in advance for those who will help! :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include<iostream.h>
#include<conio.h>

void getempcode(int emp_code);
void gethour(float hr_rate);
void getnumhr(int num_hr);
void gettax(int tax_percent);
void grossPay(int hr_rate, int num_hr);
void netAmount(float g_pay, int tax_percent);

int main()
{
  clrscr();
  int emp_code, hr_rate, num_hr, tax_percent, g_pay=0, net_amount=0;

    getempcode(emp_code);
    gethour(hr_rate);
    getnumhr(num_hr);
    gettax(tax_percent);
    grossPay(hr_rate, num_hr);
    netAmount(g_pay, tax_percent);


getch();
return 0;
}

void getempcode(int emp_code)
{
   cout << "Employee Code: ";
   cin >> emp_code;
   cout << endl;
}

void gethour(float hr_rate)
{
  cout << "Hourly Rate of Pay: ";
  cin >> hr_rate;
  cout << endl;
}

void getnumhr(int num_hr)
{
  cout << "Number of Hours Worked: ";
  cin >> num_hr;
  cout << endl;
}

void gettax(int tax_percent)
{
  cout << "Tax Percentage to be Deducted: ";
  cin >> tax_percent;
  cout << endl;
}

void grossPay(int hr_rate, int num_hr)
{
  float g_pay;
  g_pay = hr_rate * num_hr;
  cout << "Gross Amount: " << g_pay << endl;

}

void netAmount(float g_pay, int tax_percent)
{
  float net_amount;
  net_amount = g_pay - tax_percent;
  cout << "Net Amount: " << net_amount << endl;

}
Topic archived. No new replies allowed.