cout << "What is your first name?" << endl;
cin >> name;
cout << "What is your surname?" << endl;
cin >> surname;
cout << "What is your house number?" << endl;
cin >> housenum;
cout << "What is your street address?" << endl;
cin >> street;
cout << "What city do you reside?" << endl;
cin >> city;
cout << "What is your ZIP code?" << endl;
cin >> zip;
cout << "What is your pretaxable income for the previous year?" << endl;
cin >> pretax;
if (pretax <= 28000) {
cout << "You owe no taxes!" << endl;
return 0;
}
else if (28001 >= pretax <= 35000) {
cout << "Your federal tax is 10%; your state tax is 0.8%" << endl;
fedtax = pretax * .1;
statetax = pretax * .008%;
}
else if (35001 >= pretax <= 43000) {
cout << "Your federal tax is 12.5%; your state tax is 1%" << endl;
fedtax = pretax * .125;
statetax = pretax * .01%;
}
else if (43001 >= pretax <= 60000) {
cout << "Your federal tax is 20%; your state tax is 1.3%" << endl;
fedtax = pretax * .2;
statetax = pretax * .013%;
}
else if (60001 >= pretax <= 85000) {
cout << "Your federal tax is 25%; your state tax is 1.8%" << endl;
fedtax = pretax * .25;
statetax = pretax * .018%;
}
else if (85001 >= pretax <= 115000) {
cout << "Your federal tax is 30%; your state tax is 2.2%" << endl;
fedtax = pretax * .3;
statetax = pretax * .022%;
}
else if (115001 >= pretax <= 130000) {
cout << "Your federal tax is 35%; your state tax is 2.5%" << endl;
fedtax = pretax * .35;
statetax = pretax * .008%;
}
else if (130001 >= pretax <= 150000) {
cout << "Your federal tax is 37.5%; your state tax is 2.7%" << endl;
fedtax = pretax << ;x * .375;
statetax = pretax * .027%;
}
else
cout << "Your federal tax is 40%; your state tax is 3.5%" << endl;
fedtax = pretax * .4;
statetax = pretax * .035%;
}
cout << "The following information is your Tax Information Label for the inputted year." << endl;
cout << name << " " << surname
At a quick glance you are missing the opening '{' for the last else statement. Also, the return 0; should be place within the scope of main(). (Put it inside the {} of main)
Another thing is that the % symbol is not used as you might think it is '%' is actually an operator called Modulus which calculates the remainder in a division of two numbers. So something like:
thanks so much we figured out where I included the % and did not need to and a few other mistakes.. My other question is I was told that using the else statement in the manner I did is unnecessary and wrong.
example
if (pretax <= 28000) {
cout << "You owe no taxes!" << endl;
return 0;
}
else if (28001 >= pretax <= 35000) {
cout << "Your federal tax is 10%; your state tax is 0.8%" << endl;
fedtax = pretax * .1;
statetax = pretax * .008%;