#include <iostream> #include<string> using namespace std; int main() { int gross
ID: 3632538 • Letter: #
Question
#include <iostream>#include<string>
using namespace std;
int main()
{
int grossPay;
double FedralTax;
double StateTax;
double Social_midCare;
double HealthInsurance;
string name;
cout<<"please enter the employee name"<<endl;
getline(cin,name);
cout<<"please enter the gross pay of "<<name<<endl;
cin>>grossPay;
if(grossPay < 0);
{
cout<<"sorry you entered a wrong Gross Pay information"<<endl;
cout<<"please enter the Gross Pay again"<<endl;
cin>>grossPay;
}
if (grossPay > 0);
{
FedralTax=grossPay*(15.0/100);
StateTax=(3.5/100)*grossPay;
Social_midCare=(8.5/100)*grossPay;
HealthInsurance=75;
cout<<name<<endl;
cout<<"Gross Amount: ............ "<<grossPay<<"$"<<endl;
cout<<"Federal Tax: ............. "<<FedralTax <<"$"<<endl;
cout<<"State Tax: ............... "<<StateTax<<"$"<<endl;
cout<<"Social Sec / Medicare: ... "<<Social_midCare<<"$"<<endl;
cout<<"Health Insurance: ........ "<<HealthInsurance<<"$"<<endl;
grossPay=grossPay - (FedralTax + StateTax + Social_midCare + HealthInsurance);
cout<<"Net Pay: ................. "<<grossPay<<"$"<<endl;
cout << "Press any key to exit." << endl;
Explanation / Answer
please rate - thanks
you had an extra ;
#include <iostream>
#include<string>
using namespace std;
int main()
{
double grossPay;
double FedralTax;
double StateTax;
double Social_midCare;
double HealthInsurance;
string name;
cout<<"please enter the employee name"<<endl;
getline(cin,name);
cout<<"please enter the gross pay of "<<name<<endl;
cin>>grossPay;
if(grossPay < 0) //; it was here
{
cout<<"sorry you entered a wrong Gross Pay information"<<endl;
cout<<"please enter the Gross Pay again"<<endl;
cin>>grossPay;
}
if (grossPay > 0);
{
FedralTax=grossPay*(15.0/100);
StateTax=(3.5/100)*grossPay;
Social_midCare=(8.5/100)*grossPay;
HealthInsurance=75;
cout<<name<<endl;
cout<<"Gross Amount: ............ "<<grossPay<<"$"<<endl; //$ belongs before the number $15
cout<<"Federal Tax: ............. "<<FedralTax <<"$"<<endl;
cout<<"State Tax: ............... "<<StateTax<<"$"<<endl;
cout<<"Social Sec / Medicare: ... "<<Social_midCare<<"$"<<endl;
cout<<"Health Insurance: ........ "<<HealthInsurance<<"$"<<endl;
grossPay=grossPay - (FedralTax + StateTax + Social_midCare + HealthInsurance);
cout<<"Net Pay: ................. "<<grossPay<<"$"<<endl;
system("pause");
return 0;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.