C++ federal tax program

This was my original code below-- I have to add taxRate[6]-float- 6 tax rates and filingstatus[4]-string-4 filing status with descriptions which I have

The issue I have is adding the functions :
getStatusCode
getTaxIncome
calcTaxAmt
displayResults


Idont know how to add these and i havent had sleep

Write your question here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int statusCode = 0; //variable declaration for input
    double taxableIncome = 0.0;
    double taxAmt = 0.0;
    
    
    //Prompt the User to enter filing status and income
    do
    {
        cout << "Enter your filing status by a number 1 through 4 where: "<< endl;
        cout << " 1 = single" << endl;
        cout << " 2 = married filing jointly" << endl;
        cout << " 3 = married filing separately" << endl;
        cout << " 4 = head of household" << endl;
        cout << "Enter 9 if you want to end the process" << endl;
        cin >> statusCode;
        if(statusCode == 9){return 0;};
        
        
        
    } while (
             cout << "Filing status must be 1 - 4, 9 to quit\n" &&
             (statusCode < 1 || statusCode > 4)
             );
    
    
    
    do
    {
        cout << "Enter yearly imcome - must be more than $3000\n";
        cin >> taxableIncome;
        
    } while (
             cout << "*** Your taxable income must be more than $3000\n" &&
             taxableIncome <= 3000
             );
    
    
    
    switch (statusCode)
    {
        case 1:
            if (taxableIncome <= 7550)
                taxAmt = taxableIncome * 0.12;
            else if ( taxableIncome >= 7551 && taxableIncome <= 30650)
                taxAmt = taxableIncome * 0.16;
            else if ( taxableIncome >= 30651 && taxableIncome <= 74200)
                taxAmt = taxableIncome * 0.20;
            else if ( taxableIncome >= 74201 && taxableIncome <= 154800)
                taxAmt = taxableIncome * 0.28;
            else if ( taxableIncome >= 154801 && taxableIncome <= 336550)
                taxAmt = taxableIncome * 0.32;
            else
                taxAmt = taxableIncome * 0.40;
            break;
            
        case 2:
            if (taxableIncome <= 15100)
                taxAmt = taxableIncome * 0.12;
            else if (taxableIncome >= 15101 && taxableIncome <= 61300)
                taxAmt = taxableIncome * 0.16;
            else if ( taxableIncome >= 61301 && taxableIncome <= 123700)
                taxAmt = taxableIncome * 0.20;
            else if (taxableIncome >= 123701 && taxableIncome <= 188450)
                taxAmt = taxableIncome * 0.28;
            else if ( taxableIncome >= 188451 && taxableIncome <= 336550)
                taxAmt = taxableIncome * 0.32;
            else
                taxAmt = taxableIncome * 0.40;
            break;
            
        case 3:
            if (taxableIncome <= 7550)
                taxAmt = taxableIncome * 0.12;
            else if (taxableIncome >= 7551 && taxableIncome <= 30650)
                taxAmt = taxableIncome * 0.16;
            else if ( taxableIncome >= 30651 && taxableIncome <= 61850)
                taxAmt = taxableIncome * 0.20;
            else if ( taxableIncome >= 61851 && taxableIncome <= 94225)
                taxAmt = taxableIncome * 0.28;
            else if (taxableIncome >= 94226 && taxableIncome <= 168275)
                taxAmt = taxableIncome * 0.32;
            else
                taxAmt = taxableIncome * 0.40;
            break;
            
        case 4:
            if (taxableIncome <= 10750)
                taxAmt = taxableIncome * 0.12;
            else if (taxableIncome >= 10751 && taxableIncome <= 41050)
                taxAmt = taxableIncome * 0.16;
            else if (taxableIncome >= 41051 && taxableIncome <= 106000)
                taxAmt = taxableIncome * 0.20;
            else if (taxableIncome >= 106000 && taxableIncome <= 171650)
                taxAmt = taxableIncome * 0.28;
            else if (taxableIncome >= 171651 && taxableIncome <= 336550)
                taxAmt = taxableIncome * 0.32;
            else
                taxAmt = taxableIncome * 0.40;
            break;
            
        default:
            cout << "Wrong status code was entered\n";
    }
    
    
    
    cout << " Filing status $ " << statusCode << endl;
    cout << "Taxable income $ " << taxableIncome << endl;
    cout << "    Tax amount $ " << taxAmt << endl;
    
    
    
    system("pause");
    return 0;
}
Topic archived. No new replies allowed.