I'm doing a project for school pretty simple but I must be over looking something because when i wrote the code it's not evaluating how I'd like - the first if statement should be if I enter a value of 999999 because it's less then 1 million it should be taxed at 25% but it seems to automatically use 39.6 and I'm not sure whey. Any help would be much appreciated it, thanks
#include <iostream> //include needed functions
#include <string>
using namespace std;
int main()
{
string employee_name; //declare employee name variable
double ytd_compensation, additional_compensation; //declare ytd compensation and any additonal compensation like bonus
double compensationBonus; //variable for total of all compensation
double grossBonus; //The gross bonus which is 5% of your total compensation
double FITW; //Federal Income tax
double NSIT; //New York State Income Tax
double SSTAX; // Social Security Tax
double MEDTAX; //Medicare Tax
double totalTaxes; //The variable to hold the total amount of taxes taken out for your bonus
double netBonus; //How much your bonus will be worth after taxes
cout<< "The ABC company and it has decided to award its nonexecutive employees \nwith a year-end bonus based on their anticipated annual compensation \nfor the year. ABC plans to give each nonexecutive employee a bonus equal to 5% \nof their anticipated annual compensation"<<endl;
cout<< endl;
cout<< "What is your name? ";
cin>> employee_name; //ask Employee for their name and store it for later
cout<< employee_name << " How much compensation have you recieved year to date?" <<endl;
cin>> ytd_compensation; //Ask for year to date compensation
cout<< "Have you received any additional compensation?" <<endl;
cin>> additional_compensation; //Ask for any additonal Compensation like other bonuses or supplemental income
grossBonus= (ytd_compensation + additional_compensation) * .05; //Calculate the gross bonus
compensationBonus = grossBonus + ytd_compensation + additional_compensation; //Calculate your compensation with the new bonus
NSIT = grossBonus * .0962;
if (compensationBonus <= 1000000){
FITW = grossBonus * .25;
} else if (compensationBonus > 1000000)
FITW= grossBonus * .396;
if (compensationBonus <=113700){
SSTAX = grossBonus * .062;
}else if (compensationBonus >113700)
SSTAX = 0;
if (compensationBonus <= 200000){
MEDTAX = grossBonus * .0145;
}
else if (compensationBonus > 200000)
MEDTAX = grossBonus * .0235;
Have you tried outputting compensationBonus after you calculate it?
Also, you should edit your post and repaste your code between[code]code tags[/code] so it's easier to read. I say repaste because if you just edit your post all the indentation at the start of the lines will be gone.