Alright I'm making a program to calculate a paycheck heres what I have:
#include <iostream>
using namespace std;
int main()
{
//Declares the different variables used
double Gross_Pay; //Gross Pay
double FIT; //Federal Income Tax
double SIT; //State Income Tax
double SST; //Social Security Tax
double Union_Dues; //Union Dues
double Hours_Worked; //Hours Worked
double Pay_Rate; //Pay Rate
double Net_Pay; //Net Pay
double Health; //Health Tax
double Health_Cov; //Health Coverage
char f, F, s, S;
//Program introduction
cout << "Hello. Welcome to the paycheck calculator." << endl;
cout << "Enter your pay rate:"; //Intakes the users pay rate
cin >> Pay_Rate;
cout << "Enter the number of hours you worked:"; //Intakes number
cin >> Hours_Worked; //of hours worked
cout << "Enter s for single or f for family health coverage:";
cin >> Health_Cov; //Intakes health coverage as family or si\
ngle
//Equations to determine final results
Gross_Pay = Hours_Worked * Pay_Rate; //Calculates Gross Pay
FIT = Gross_Pay * .14; //Calculates the Federal Income Tax
SIT = Gross_Pay * .05; //Calculates the State Income Tax
SST = Gross_Pay *.06; //Calculates the Social Security Tax
if (Hours_Worked >= 35)
Union_Dues = 10;
else
Union_Dues=0;
if ((Health_Cov == f) || (Health_Cov == F))
Health = 35;
else ((Health_Cov == s) || (Health_Cov == S)
Health = 0;
if ((Health_Cov != s)&& (Health_Cov != S) && (Health_Cov != f) && (Health_Cov\
!= F))
Health = "Error";
cout << "Your pay rate: " << Pay_Rate << endl;
cout << "Hours Worked: " << Hours_Worked << endl;
cout << "Gross Pay: " << Gross_Pay << endl;
cout << "Federal Tax: " << FIT << endl;
cout << "State Tax: " << SIT << endl;
cout << "Social Security Tax: " << SST << endl;
cout << "Union Dues: " << Union_Dues << endl;
cout << "Health: " << Health << endl;
cout << "---------------------------" << endl;
cout << "Net Pay:" << Gross_Pay << endl;
return 0;
}
Heres the error messages I get:
Stopped (user)
unix2% g++ hw2.cpp -o hw2
hw2.cpp: In function `int main()':
hw2.cpp:61: parse error before `='
hw2.cpp:62: parse error before `)'
hw2.cpp:77: confused by earlier errors, bailing out
unix2%
I'm a complete C++ newbie and this is due in like 3 hours so please help Im lost
#include <iostream>
using namespace std;
int main()
{
//Declares the different variables used
double Gross_Pay; //Gross Pay
double FIT; //Federal Income Tax
double SIT; //State Income Tax
double SST; //Social Security Tax
double Union_Dues; //Union Dues
double Hours_Worked; //Hours Worked
double Pay_Rate; //Pay Rate
double Net_Pay; //Net Pay
double Health; //Health Tax
double Health_Cov; //Health Coverage
char f, F, s, S;
//Program introduction
cout << "Hello. Welcome to the paycheck calculator." << endl;
cout << "Enter your pay rate:"; //Intakes the users pay rate
cin >> Pay_Rate;
cout << "Enter the number of hours you worked:"; //Intakes number
cin >> Hours_Worked; //of hours worked
cout << "Enter s for single or f for family health coverage:";
cin >> Health_Cov; //Intakes health coverage as family or si\
ngle
//Equations to determine final results
Gross_Pay = Hours_Worked * Pay_Rate; //Calculates Gross Pay
FIT = Gross_Pay * .14; //Calculates the Federal Income Tax
SIT = Gross_Pay * .05; //Calculates the State Income Tax
SST = Gross_Pay *.06; //Calculates the Social Security Tax
if (Hours_Worked >= 35)
Union_Dues = 10;
else
Union_Dues=0;
if ((Health_Cov == f) || (Health_Cov == F))
Health = 35;
else ((Health_Cov == s) || (Health_Cov == S)
Health = 0;
if ((Health_Cov != s)&& (Health_Cov != S) && (Health_Cov != f) && (Health_Cov\
!= F))
Health = "Error";
cout << "Your pay rate: " << Pay_Rate << endl;
cout << "Hours Worked: " << Hours_Worked << endl;
cout << "Gross Pay: " << Gross_Pay << endl;
cout << "Federal Tax: " << FIT << endl;
cout << "State Tax: " << SIT << endl;
cout << "Social Security Tax: " << SST << endl;
cout << "Union Dues: " << Union_Dues << endl;
cout << "Health: " << Health << endl;
cout << "---------------------------" << endl;
cout << "Net Pay:" << Gross_Pay << endl;
return 0;
}
Heres the error messages I get:
Stopped (user)
unix2% g++ hw2.cpp -o hw2
hw2.cpp: In function `int main()':
hw2.cpp:61: parse error before `='
hw2.cpp:62: parse error before `)'
hw2.cpp:77: confused by earlier errors, bailing out
unix2%
I'm a complete C++ newbie and this is due in like 3 hours so please help Im lost