plzzz help with this program


hello

i got the whole program but its just one error that i cant resolve it to make the program run and its salary. if you could help plz

#include <iostream>
#include<iomanip>
using namespace std;

//function prototypee
void calcFedTaxes(double, double, double,double&,double&);
void calcNetPay(double, double, double, double&);
void displayInfo(double, double, double);

int main ()
{
double Salary = 0.0;
const double FWTRate = .2;
const double FICARate = .08;
double FWT = .2;
double FICA = .08;
double NetPay = 0.0;

//enter input data

cout <<"enter salary:$";

cin >> salary;


//valida input data

while (salary>0)

{

//valid data
calcFedTaxes (Salary, FWTRate, FICARate, FWT, FICA);
calcNetPay (FWT, FICA, NetPay, Salary);
displayInfo (FWT, FICA, NetPay);

cout << fixed;

cout.precision(0);

cout << "salary: " << salary << endl;


return 0;

} //end of main function

//*****program-defined functions*****

void CalcFedTaxes (double salary, double FwtRate, double FICARate, double &FWT,double &FICA)
{


//calculate federal taxes

FWT = salary * FWTRate;

FICA = salary * FICARate;

} //end of calcFedTaxes function
void CalcNetPay( double salary,double FWT,double FICA,double &Netpay)
{
NetPay=salary-(FWT+FICA);

}//end of calcNetPay function

void displayInfos( double FWT,double FICA,double NetPay)
{
//display the FWT,FICA,NetPay
cout<<"federal withholding tax"<<endl;
cout<<"federal insurance contribution"<<endl;
cout<<"Net Pay"<<endl;
}
Use code tags (the <> button on the 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
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
#include <iostream>
#include<iomanip>
using namespace std;

//function prototypee
void calcFedTaxes(double, double, double,double&,double&);
void calcNetPay(double, double, double, double&);
void displayInfo(double, double, double);

int main ()
{
double Salary = 0.0;
const double FWTRate = .2;
const double FICARate = .08;
double FWT = .2;
double FICA = .08;
double NetPay = 0.0;

//enter input data

cout <<"enter salary:$";

cin >> salary;


//valida input data

while (salary>0)

{

//valid data
calcFedTaxes (Salary, FWTRate, FICARate, FWT, FICA);
calcNetPay (FWT, FICA, NetPay, Salary);
displayInfo (FWT, FICA, NetPay);

cout << fixed;

cout.precision(0);

cout << "salary: " << salary << endl;


return 0;

} //end of main function

//*****program-defined functions*****

void CalcFedTaxes (double salary, double FwtRate, double FICARate, double &FWT,double &FICA)
{


//calculate federal taxes

FWT = salary * FWTRate;

FICA = salary * FICARate;

} //end of calcFedTaxes function
void CalcNetPay( double salary,double FWT,double FICA,double &Netpay)
{
NetPay=salary-(FWT+FICA);

}//end of calcNetPay function

void displayInfos( double FWT,double FICA,double NetPay)
{
//display the FWT,FICA,NetPay
cout<<"federal withholding tax"<<endl;
cout<<"federal insurance contribution"<<endl;
cout<<"Net Pay"<<endl;
}


Errors:
1
2
3
4
5
6
prog.cpp: In function ‘int main()’:
prog.cpp:23: error: ‘salary’ was not declared in this scope
prog.cpp:51: error: a function-definition is not allowed here before ‘{’ token
prog.cpp:62: error: a function-definition is not allowed here before ‘{’ token
prog.cpp:68: error: a function-definition is not allowed here before ‘{’ token
prog.cpp:73: error: expected `}' at end of input 


Variables are case-sensitive, so make sure you are consistent. On line 12, you define the variable "Salary" but you use a variable called "salary" later in lines 23, 28, and 41.

Also, you are missing the closing brace of the while loop on line 28.
so how can i fix the salary.... dont have a clueeee
Capitalize the 's' of "salary" on lines 23, 28, and 41.

Then on line 56 you used "FWTRate" instead of "FwtRate".

Then on line 63 you used "NetPay" instead of "Netpay".

The compiler output is very informative when it comes to these typo problems. It gives the line number and the offending words. Do your best to understand what it's saying.

EDIT: Turns out there are more typos. Function names are also case-sensitive. Lines 6-8 you declare 3 functions, but then define 3 different functions on lines 50, 61, and 67 because you spelled them differently or didn't capitalize a letter.
Last edited on
ok i got i am trying

now i m having this kinda of problems error LNK2019: unresolved external symbol "void __cdecl calcNetPay(double,double,double,double &)" (?calcNetPay@@YAXNNNAAN@Z) referenced in function _main... could you just tell me what is exactly plz
anybody help with this issue

i see that the function prototype match function call and definition but still have the problem
there is no close braces for while function

in line 7 the function prototype is
void calcNetPay(double, double, double, double&);

but in line 61, the function definitions is
void CalcNetPay( double salary,double FWT,double FICA,double &Netpay)

Use the same name and format for functions prototypes and implementations
Last edited on
Topic archived. No new replies allowed.