Help me

i wrote a program that calculates how much someone made in a week. the calculations are almost correct. What formula should i use to make the program show the actual number in "number of dependents" and calculate where the worker has 3 or more dependents, it takes out an additional 10$ from the whole netpay?

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
71
72
73
74
75
76
77
78
  #include <iostream>
using namespace std;

int main ()
{
   int regHours = 0;     // Regular Hours
   float hourlyPay, gross, otime, socialtax, federaltax, statetax, uniondues, dep, health; // gross income, overtime, social tax, federal tax, state tax, union dues, depen covered, health insurance 
   double opay, sopay, fpay, spay, unpay, deppay, healthpay, netpay; // overtime scoial federal state union dependents and health withholdings including netpay  
   

{
        cout << "Hello Employee" << endl;
        
        cout << "Enter hours you have worked: ";
        cin >> regHours;        

        cout << "Enter hourly pay rate: $";
		cin  >> hourlyPay;
		
		cout << "Enter overtime rate: " ;
        cin >> otime;

		cout << "Enter percentage to be withheld for social security tax in decimal form: ";
		cin  >> socialtax;

		cout << "Enter percentage to be withheld for federal income tax in decimal form: ";
		cin  >> federaltax;

		cout << "Enter percentage to be withheld for state income tax in decimal form: ";
		cin  >> statetax;
		
		cout << "Enter Union dues: ";
		cin  >> uniondues;
		
		cout << "Enter number of dependents covered: ";
		cin  >> dep;
		
		
		
		gross = regHours * hourlyPay;                                      //Grosspay
		if(regHours > 40)
		{
        otime = (regHours + otime) * hourlyPay + otime * hourlyPay / 2.0;
     }
		sopay = gross * socialtax;                                         //Social income tax withholdings
		fpay = gross * federaltax;                                         //Federal income tax withholdings
		spay = gross * statetax;                                           //State withholdings
		if(unpay = gross - uniondues)
        {
                 unpay = 6;
                 }                                         //
        if(deppay >= 3)
        {
            netpay = gross - 10;
            healthpay = deppay;
            }
            else( deppay = 2);
            healthpay = deppay;                                       
        
        netpay = gross - opay - sopay - fpay - spay - unpay - deppay;  //Netpay
		
		cout << "Weekly Report: \n\n";
		cout << "Regular Hours: " << regHours << endl;
		cout << "Gross Pay: $" << gross << endl;
		cout << "Social income tax: $" << sopay << endl;
		cout << "Federal income tax: $" << fpay << endl;
		cout << "Union dues: $" << unpay << endl;
		cout << "Number of dependents covered: $" << deppay << endl;
		cout << "Additional heaalth insurance expence: " << healthpay << endl;
		cout << "Net take home pay: $" << netpay << endl;
		
    }
		
		system("pause");
		return 0;
		
}
the worker has 2 dependents
what formula to use if it has 3 or more dependents but how many dependents covered.
Topic archived. No new replies allowed.