So lost with functions

On lines 45 and 83 it is telling me "Expected unqualified-id" what does that mean? I can't seem to notice the error. I am so lost with how to read from files and use them etc.

SAMPLE INPUT FILE
Miss Informed
125432 32560.0
Sweet Tooth
5432 9500
Bad Data
1255 -4500.0
John Smith
1225 3500.0
Nancy Brown
1555 154500.00

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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>

using namespace std;



int main()
{
    
float CalcIncomeTax(float );
float CalcNetSalary(float, float );
void OpenFile(ifstream& fin);
void OpenFile(ofstream& fout);
void Instruct(void);
void ReadData(ifstream & fin, string& Name , int &Id, float& grossIncome);
void Print(ofstream&, string, int, float, float, float);
void Process(float netSalary , float grossIncome, float incomeTax);
    
    
    ifstream    fin;
    ofstream    fout;
    string      Name;
    int         Id;
    float       grossIncome;
    float       netSalary;
    float       incomeTax;
 
    
        ReadData(fin, Name, Id, grossIncome);
    while(!fin.eof())
        {
            netSalary = CalcNetSalary(grossIncome,incomeTax);
            incomeTax = CalcIncomeTax(grossIncome);
            Print(fout, Name, Id, grossIncome, incomeTax, netSalary);
            ReadData(fin, Name, Id, grossIncome);
        }
    fin.close();
}


 void ReadData(ifstream & fin, string& Name , int &Id, float& grossIncome);
{
    fin >> Name >> Id >> grossIncome;
    while (!fin && !fin.eof())
    {
        cout <<Name <<" Bad data type in the file.\n Record will be skipped.\n" ;
		fin.clear();
        fin >> Name >> Id >> grossIncome;
    }
}

    

void OpenFile(ifstream&fin)
{
    cout <<"\nEnter the name and location of the input file:   " << endl;
    string file_input;
    getline(cin, file_input);
    fin.open(file_input.c_str() ) ;
    if (fin.fail())
    {
        cout << "FAIL. " << endl;
    }
    
}
void OpenFile(ofstream &fout)
{
    cout <<"Enter the name and location of the output file:   ";
    string file_output;
    getline(cin, file_output);
    fout.open( file_output.c_str() );
    if (fout.fail())
    {
        cout << " FAIL. " << endl;
    }
    
}

void Instruct();
{
    cout << "Programmer:"<< setw(25) << "//" << endl;
    cout << "Programming Assignment" << setw(5) << "4" << endl;
    cout << "This program will calculate and report tax liability" << endl;
    }
    
float CalcIncomeTax(float grossIncome)
{
    float incomeTax = 0;
    
    if (grossIncome <= 3500)
    {
        incomeTax = 0.00;
    }
    else if (grossIncome >= 3500 && grossIncome <= 8000)
    {
        incomeTax = 0 + 0.06 * (grossIncome - 3500);
    }
    else if (grossIncome >= 8000 && grossIncome <= 20000)
    {
        incomeTax = 270.00 + 0.11 * (grossIncome - 8000);
    }
    else if (grossIncome >= 20000 && grossIncome <= 34000)
    {
        incomeTax = 1590.00 + 0.17 * (grossIncome - 20000);
    }
    else if (grossIncome >= 34000 && grossIncome <= 54000)
    {
        incomeTax = 3970.00 + 0.24 * ( grossIncome - 34000);
    }
    else if (grossIncome >= 54000)
    {
        incomeTax = 8770.00 + 0.32 * ( grossIncome - 52000);
    }
    else if (grossIncome < 0)
    {
        cout << "****Invalid Income";
    }
    return(incomeTax);
}



float CalcNetSalary( float grossIncome, float incomeTax)
    {
        float netSalary;
        netSalary = grossIncome - incomeTax;
        return (netSalary);
    }

void Print(ofstream& fout, string Name, int Id, float grossIncome, float incomeTax, float netSalary)
    {

        
        fout << setfill(' ') << left << setw(18) << "\tName";
        fout << setfill(' ') << left << setw(12) << "ID";
        fout << setfill(' ') << left << setw(17) << "Gross Income";
        fout << setfill(' ') << left << setw(12) << "Taxes";
        fout << setfill(' ') << left << setw(16) << "Net Income";
        fout << endl;
        
        fout << setfill('=') << setw(70)<<"\t";
        fout<<endl;
        
        fout << setprecision(2) << showpoint << fixed;
        fout << setfill(' ') << "\t" << setw(17)<< Name;
        fout << setfill(' ') << setw(12) << Id;
        fout << '$' << setfill(' ') << setw(16) << grossIncome;
        fout << '$' << setfill(' ') << setw(11) << incomeTax;
        fout << '$' << setfill(' ') << setw(16) << netSalary;
        fout << endl;
        return;
    }


Last edited on
Simply remove semicolons from the preceding lines - but that's only number one on the todo list here ;)
Last edited on
Line 44 and 82 you have ; that shouldn't be there.

Line 35 looks like you are trying to pass in incomeTax but I don't see where to are getting an initial value before passing it in.
@JockX @mobotus
thank you that worked perfectly.
Any advice on how to read from file and get whole name etc. ? I need some help with those.
Topic archived. No new replies allowed.