logical errors when i compile.
when i compile the code i get the console screen ( which is a good thing sicne there is no syntax errors) i have a problem with the code not understand when i type in 6000 it suppose 180 since the tax is 3%.
Code:
//adds the iostream library to the program
#include <iostream>
//adds the iomanip library to the program
#include <iomanip>
//adds the math library to the program
#include <math.h>
//informs the compiler you are using the standard library set
using namespace std;
double GetIncome (double Income, double tax)
{
double NEWI;
NEWI = Income * (tax/100) ;
cout << "You have entered an income of $"<< Income << endl;
cout << "The income tax owed is $"<< NEWI<< endl;
return NEWI;
}
int main ()
{
int Income;
double tax;
double NEWI;
cout << "Mini Program 5.1:" << endl;
cout << "Enter the income: " << endl;
cin >> Income;
if (Income <= 5000)
{tax = 0;
cout << "You have entered an income of $"<< Income << endl;
cout << "The income tax owed is $"<< NEWI<< endl;}
else if (Income <=10000)
{tax = 3;
cout << "You have entered an income of $"<< Income << endl;
cout << "The income tax owed is $"<< NEWI<< endl;}
else if (Income <=20000)
{tax = 5.5;
cout << "You have entered an income of $"<< Income << endl;
cout << "The income tax owed is $"<< NEWI<< endl;}
else if (Income <=40000)
{tax = 10.8;
cout << "You have entered an income of $"<< Income << endl;
cout << "The income tax owed is $"<< NEWI<< endl;}
else
{tax = 23.7;
cout << "You have entered an income of $"<< Income << endl;
cout << "The income tax owed is $"<< NEWI<< endl;}
system("pause");
return 0;
}