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;
}

Hey if you know of a better place to ask for help with this please share. Thanks :)

I Figured it out. My error was I had changed the way I was adding up the totalTax and forgot to change the taxableIn to grossIncome. Thanks to anyone who was going to help. :)

Well, I just came to the same conclusion. A bit late, but I'm glad you found it out by yourself. :)

commented: Thank you anyway. I find myself making the dumbest mistakes sometimes smh +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.