HELP!!

Thank you so much! I don't know why the code doesn't work..

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

using namespace std;
\axes, CPP, EI, UD;
void DisplayPay (int OTPay, double Pay, const double HOURLYPAY, double OT, double DTime, double NetPay);

void DisplayDeductions(double Taxes, double CPP, double EI, double UD, double Money, double NetPay);

int main()
{
    int hours=0;
    
    char repeat = 'y';
    
    //user instructions
    cout<<"This program will calculate your pay based on how many hours youhave worked. This program will show your Gross Pay (indicating normal & overtime quantities), the amounts going to taxes, cpp, uic, union and the net pay for the week."<<endl<<endl;
    
    do
    {
        cout<<"Please enter the number of hours you have worked: ";
        cin>>hours;
        
        void DisplayPay (int hours, double RegPay, double OverTPay, double Pay, const double HOURLYPAY, double OT, double DTime);
        
        void DisplayDeductions(double &Taxes, double &CPP, double &EI, double &UD, double &Money, do
        
    }while (repea
    }
    
    else if(45<hours)
    {
        Pay=(HOURLYPAY*40);
        DTime= (hours-45);
        OverTPay=(5*15.75)+(DTime*21.);
        NetPay=(DTime*21)+(5*15.75)+(40*HOURLYPAY);
    }
}
Last edited on
I don't know why the code doesn't work..
What make you think it doesn't work?

Note:

else if(hours<=40 & hours<=45)

& is a bitwise operator. Use && instead as the logical operator. See:

http://www.cplusplus.com/doc/tutorial/operators/


Please use code tags: [code]Your code[/code]
Read this: http://www.cplusplus.com/articles/z13hAqkS/
Thanks for your advice. On my C++ software, it showed it has built successfully, but I don't know why it doesn't display the info that I want.. Like the deductions, regular pay, net pay and etc.. It didn't show up..lol..
Last edited on
Line 27, 29: These are function prototypes, not function calls.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Last edited on
So is this right?
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
#include <iostream>
#include <iomanip>

using namespace std;

const double HOURLYPAY=10.50;
double RegPay, OverTPay, DOTPay, Pay, OT, DTime, NetPay;
double Taxes, CPP, EI, UD, Money, Deductions;
void DisplayPay (int hours, double RegPay, double OverTPay, double DOTPay, double Pay, const double HOURLYPAY, double OT, double DTime, double NetPay);
void DisplayDeductions(double Taxes, double CPP, double EI, double UD, double Money, double NetPay);

int main()
{
    int hours=0;
    
  
    UD=NetPay*0.004;
    Money=NetPay-Taxes-CPP-EI-UD;
    
    cout<<"Here are your deductions: "<<endl<<endl;
    cout<<"Taxes: "<<Taxes<<endl;
    cout<<"CPP: "<<CPP<<endl;
    cout<<"EI: "<<EI<<endl;
    cout<<"Union Dues: "<<UD<<endl;
}

Last edited on
I am afraid it's not ok.

error C2660: 'DisplayPay' : function does not take 7 arguments Line 26
error C2660: 'DisplayDeductions' : function does not take 5 arguments Line 27

Why do you have so many parameters ?
In DisplayPay you need only the number of hours. All the other variables can be declared inside the function.

In DisplayDeductions you only need to pass NetPay.
Topic archived. No new replies allowed.