// program 5: implement a decision structure for the following computation
# include <iostream>
using namespace std;
//function used
void instruction ();
int main ()
{
int income, tax,total;
instruction();
// get the income
cout << " input your income : $" <<endl;
cin >> income;
if (income <= 15000)
{
cout << " Pay no tax " << " your income is "<< income<< endl;
}
else if ( 15000 < income <= 44000)
{
tax = (income - 15000) * (20/100);
total = income - tax;
cout << " Your tax would be 20% on the amount in excess of $15000"<< endl;
cout << " Your income after tax would be $ " << total << endl ;
}
else if ( 44000 < income <= 68150)
{
tax = ( 44000 * (22/100) + (income - 44000) * (28/100) );
total = income - tax;
cout << " Your income after tax would be $ " << total<< endl ;
}
else if ( 68150 < income <= 121300)
{
tax = ( 58150*(28/100) + (income - 58150) * (31/100));
total = income - tax;
cout << " Your income after tax would be $ " << total<< endl ;
}
else if (121300< income<= 263750)
{
tax = ( 121300*(31/100) + (income - 121300) * (36/100));
total = income - tax;
cout << " Your income after tax would be $ " << total<< endl ;
}
else if ( income> 263750)
{
tax = ( 263750 *(36/100) + (income - 121300) * (39.6/100));
total = income - tax;
cout << " Your income after tax would be $ " << total<< endl ;
}
system ("pause" );
return total;
return 0;
}
void instruction()
{
cout << "This program compute gross and net salary . " << endl;
}
I checked many times and the program does not have error. how ever, the result is really weird, I dont' know why it doesn't calculate