The program seems to be building fine however I can only get it to return "Your tax amount is: 0.00". I've stared at the thing for hours and cann't for the life of me find my problem/problems. Any suggestions are extremely appreciated.
/*
* File: main.cpp
* Author: Callie Tester
* Purpose: Ch7-Ex5 To calculate federal taxes.
* Created on November 6, 2015, 10:50 AM
*/
#include <iostream>
#include <iomanip>
using namespace std;
const double mDuction = 7000.00;
const double sDuction = 4000.00;
const double pDuction = 1500.00;
void getData(char& mStatus, int& numChildren, double& grossIncome,double& pension);
double taxAmount (char mStatus, int numChildren, double grossIncome,double pension);
int main()
{
char mStatus;
int numChildren = 0;
double grossIncome = 0.0;
double pension = 0.0;
double tax = 0.0;
cout << fixed << showpoint << setprecision(2);
cout << "Welcome to the federal tax calculator" << endl;
getData(mStatus,numChildren,grossIncome,pension);
cout << endl;
tax = taxAmount (mStatus, numChildren, grossIncome, pension);
cout << "Your tax amount is: " << tax << endl;
return 0;
}
void getData(char& mStatus, int& numChildren, double& grossIncome,double& pension)
{
cout << "Enter your marital status (M for married or S for Single): " ;
cin >> mStatus;
cout << endl;
cout << "Enter number of children under the age of 14. (If none enter '0'): ";
cin >> numChildren;
cout << endl;
cout << "Enter the gross income of your home : ";
cin >> grossIncome;
cout << endl;
cout << "Enter in decimal form percentage of gross income contributed to pension plan up to .06: ";
cin >> pension;
cout << endl;
}
double taxAmount (char mStatus, int numChildren, double grossIncome,double pension)
{
double totalTax=0.0;
double deduction=0.0;
double taxableIn=0.0;
int numDeductions=0;
if (mStatus == 'm' || mStatus == 'M')
{
numDeductions = 2 + numChildren;
deduction = mDuction;
}
else
{
numDeductions = 1 + numChildren;
deduction = sDuction;
}
totalTax = (((grossIncome - deduction) - (pDuction * numDeductions)) - (grossIncome * pension / 100));
if (0<= taxableIn && taxableIn <= 15000.0)
totalTax = taxableIn * .15;
else if (15001 <= taxableIn && taxableIn <= 40000.0)
totalTax = 2250 + (taxableIn - 15000.0) * .25;
else
totalTax = 8460 + (taxableIn - 40000.0) * .35;
return totalTax;
}