0

Alright you guys im new to c++ and programming and i have this homework assignment that is incomplete at the moment and i dont know where i messed up.

/*Write a program to compute income tax as follows:

First, display the following menu and ask the user to select his or her filing status:

1. Single

2. Married filing separately

3. Married filing jointly

4. Head of household

For Single status, apply a deduction of $2000, for #2 $1700, for #3, $2300 and Head of household $2700.
Add to the deduction amount, $150 for each dependent up to a maximum of 4 dependents if single, 
$125 for each dependent up to a maximum of 4 for Married filing separately, $175 for each dependent, 
up to a maximum of 5, if married filing jointly, or head of household. 
Add also 15% of any uncovered (out-of-pocket) medical expenses for singles and married filing individually, 
and 20% for the other two.  Likewise add 20% of any college expenses to first and second and 25% for the other two, 
as well as 20% of charitable contributions for all four.

Then, get user's income and compute the taxable income by subtracting the deduction from his or her income. 
Anyone with a taxable income of less than $8,000 pays no taxes. 
For the rest, the first $15,000 of the income has a tax rate of 10%, the next $25,000 gets taxed at 15%, 
the next $30,000 at 20%, the next $30,000 at 25% and anything above $100,000 at 30%.  
So, for example, someone who had taxable income of $125,000, her first $15,000 gets taxed at 10% ($1,500), 
plus 15% of $25,000 ($3,750), plus 20% of $30,000 ($6,000), plus 25% of $30,000 ($7,500) and the remaining $25,000 at 30% ($7,500)
for a total tax amount of $26,250.  For someone with income of $13,000, the tax is 10% of that or $1,300.  
For someone who made $7,999.99 it would be 0, but for someone who made $8,000, it's $800. 
For someone who made $30,000, it would be 10% of $15,000 or $1,500 plus 15% of the remaining $15,000 or $2,250 making it $3,750, 
and so on.

Next, ask for the amount of taxes already paid and subtract from tax due.
If the difference is positive, display the amount due and the address where the check should be sent to
(Franchise Tax Board, Fresno, CA).  Otherwise, if the amount of tax is negative, 
display the refund amount and ask and read the address where the tax refund should be sent to. 
If the difference is 0, tell the user he or she owes nothing and will be getting nothing.*/

#include <iostream>
#include <math.h>
using namespace std;
int main()
{
    int filing, dependents, income;
    double med1 = .15, med2 = .2, col1 = .2, col2 = .25, charity= .2, paidtax1, paidtax2, paidtax3, paidtax4, paidtax5,
        deduction, leftover, taxrate1, taxrate2, taxrate3, taxrate4, taxrate5, amount1, amount2, amount3, amount4, amount5;

    cout << "\nEnter filing status:\n"
         << "\n1. Single\n"
         <<   "\n2. Married filing separately\n"
         << "\n3. Married filing jointly\n"
         << "\n4. Head of household\n"
         << "\nEnter your selection\n";
    cin >> filing;

    cout << "\nEnter income amount:\n ";
    cin >> income;

    cout << "\nEnter number of dependents: \n"
         << "\n0. None\n"
         << "\n1. One\n"
         << "\n2. Two\n"
         << "\n3. Three\n"
         << "\n4. Four\n"
         << "\n5. Five\n"
         << "\nEnter number of dependents: ";
    cin >> dependents;



    if (filing == 1)
    {
        deduction  =  income - 2000 - ((income * med1)+ (income * col1)+ ( income * charity)); 
        if (dependents == 0)
        {
            cout << income - deduction << endl;
        }
        else if( dependents == 1)
        {
            cout << income - deduction -  150 << endl;
        }
        else if( dependents == 2)
        {
            cout << income - deduction - 300 << endl;
        }
        else if( dependents == 3)
        {
            cout << income -  deduction - 450 << endl;
        }
        else if( dependents == 4)
        {
            cout << income-  deduction - 600 << endl;
        }
        else
        {
            cout << "\nInvalid entry\n";
        }
    }
    else if( filing ==2)
    {
        deduction = income - 1700 - ((income * med1)+ (income * col1)+ ( income * charity));
        if (dependents == 0)
        {
            cout << income -  deduction << endl;
        }
        else if( dependents == 1)
        {
            cout << income - deduction -  125 << endl;
        }
        else if( dependents == 2)
        {
            cout << income - deduction - 250 << endl;
        }
        else if( dependents == 3)
        {
            cout << income - deduction - 375 << endl;
        }
        else if( dependents == 4)
        {
            cout << income - deduction - 500 << endl;
        }
        else
        {
            cout << "\nInvalid entry\n";
        }
    }
    else if(filing == 3)
    {
        deduction = income - 2300 - ((income * med2) + (income * col2) + (income * charity));
        if (dependents == 0)
        {
            cout << income - deduction << endl;
        }
        else if( dependents == 1)
        {
            cout << income - deduction -  175 << endl;
        }
        else if( dependents == 2)
        {
            cout << income - deduction - 350 << endl;
        }
        else if( dependents == 3)
        {
            cout << income - deduction - 525 << endl;
        }
        else if( dependents == 4)
        {
            cout << income - deduction - 700 << endl;
        }
        else if( dependents == 5)
        {
            cout << income - deduction - 875 << endl;
        }
    }
    else if(filing == 4)
    {
        deduction = income - 2700 - ((income * med2) + (income * col2) + (income * charity));
        if (dependents == 0)
        {
            cout << income-  deduction << endl;
        }
        else if( dependents == 1)
        {
            cout << deduction -  175 << endl;
        }
        else if( dependents == 2)
        {
            cout << income - deduction - 350 << endl;
        }
        else if( dependents == 3)
        {
            cout << income - deduction - 525 << endl;
        }
        else if( dependents == 4)
        {
            cout << income - deduction - 700 << endl;
        }
        else if( dependents == 5)
        {
            cout << income - deduction - 875 << endl;
        }
    }

    else 
        cout << "\nInvalid Entry\n";


    leftover = income - deduction;
    taxrate1 = income -  (leftover * .10);
    taxrate2 = income -  (leftover * .15 + taxrate1);
    taxrate3 = income -  (leftover * .20 + taxrate2 + taxrate1);
    taxrate4 = income -  (leftover * .25 + taxrate3 + taxrate2 + taxrate1);
    taxrate5 = income -  (leftover * .30 + taxrate4 + taxrate3 + taxrate2 + taxrate1);
    amount1 = income - taxrate1;
    amount2 = income - taxrate2;
    amount3 = income - taxrate3;
    amount4 = income - taxrate4;
    amount5 = income - taxrate5;


    if (leftover == 15000 && leftover >= 8000)
    {
        cout << "\nThis is your tax rate = " << taxrate1 << endl;
        cout << amount1 << endl;
    }
    else if (leftover == 40000 )
    {   
        cout << "\nThis is your tax rate = " << taxrate2 << endl;
        cout << amount2 << endl;
    }
    else if ( leftover == 70000 )
    {
        cout << "\nThis is your tax rate = " << taxrate3 << endl;
        cout << amount3 << endl;
    }
    else if ( leftover == 100000 )
    {
        cout << "\nThis is your taxrate = " << taxrate4 << endl;
        cout << amount4 << endl;
    }
    else 
    {
        cout << "\nThis is your taxrate = " << taxrate5 << endl;
        cout << amount5 << endl;
    }



    paidtax1 = taxrate1 - amount1;
    paidtax2 = taxrate2 - amount2;
    paidtax3 = taxrate3 - amount3;
    paidtax4 = taxrate4 - amount4;
    paidtax5 = taxrate5 - amount5;

    if (paidtax1 > 0 || paidtax2 > 0 || paidtax3 > 0 || paidtax4 > 0 || paidtax5 > 0)

        cout << "\nPlease send your check to Franchise Tax Board, Fresno, CA.\n " << endl;
    else if (paidtax1 < 0 || paidtax2 < 0 || paidtax3 < 0 || paidtax4 < 0 || paidtax5 < 0)
        cout << "\nPlease send your check to Franchise Tax Board, Fresno, CA.\n " << endl;
    else
        cout << "\nNo taxes are owed, no money is refunded\n" << endl;


    system("pause");
    return 0;
}
2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by Despairy
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.