Net Income Program Problem

I'm working on a program to read the hours worked and rate of pay. It would then calculate the pay, taxes, deductions. I also have to account for overtime which is paid in time and a half. For an example you would input 47 hours and 15 $/hour. It would then show this in output

40 hours regluar time: $600.00
7 hours overtime: $157.50
Total wages: $757.50


Income Tax: $128.00
Provincial Tax: $53.03
CPP: $29.54
EI: $19.31

Net Income: $526.84


Here is my code

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
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
double hours=0;
double rate =0;
double pay=0;
double overtime=0;
double regPay=0;
const double incomeTax=0.17;
const double provTax=0.07;
const double CPP=0.039;
const double EI=0.0255;
double TOTAL=0;
double regPay=0;
double OTPay=0;
const double OTRate=1.5;
double OTHours=0;


//Get the number of hours worked.
cout << "How many hours worked? ";
cin >> hours;

if (hours > 40)
{
overtime =hours-40;
hours=40;
}

// Get the hourly pay rate.
cout << "How much do you get paid per hour? ";
cin >> rate;

// Calculate the pay.
pay = (hours * rate) + (overtime * (rate*1.5));

//Calculate the regular pay
regPay=rate * 40;
cout<<"Regular pay is: $"<<regPay<<endl;

//Calculate overtime pay
OTHours=(hours-40);
OTPay=OTHours*OTRate;
cout"Overtime pay is: $"<<OTPay<<endl;

// Display the pay.
cout << "You have earned $"<<fixed<<setprecision(2)<<pay<<endl<<endl;

//Calculate and print Income Tax
cout<<"Income Tax: $"<<(incomeTax*pay)<<endl;
cout<<"Provincial Tax: $"<<(provTax*pay)<<endl;
cout<<"CPP: $"<<(CPP*pay)<<endl;
cout<<"EI: $"<<(EI*pay)<<endl<<endl<<endl;

TOTAL=pay-((incomeTax*pay)+(provTax*pay)+(CPP*pay)+(EI*pay));
cout<<"Net Income: $"<<TOTAL<<endl;


system ("pause");

return 0;


}


With this it would not output the regular pay and the overtime pay. Here is what the output is currently.
40 hours regluar time: $600.00


Income Tax: $128.00
Provincial Tax: $53.03
CPP: $29.54
EI: $19.31

Net Income: $526.84

Also, yes I know that some people will call me out on using system("pause"). If you have any questions feel free to ask.
Last edited on
Line 48, you forgot the << operator after the cout.
ok thanks but it still does not show those two lines that show you the regular time and overtime pay
Topic archived. No new replies allowed.