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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
#include <iostream>
using namespace std;
#include <iomanip>
/* Incremental income per tax bracket(single/jointly)
$0 to $12,400.00(single) and $0 to $24,800.00(jointly) 0%
$12,400.01 to $22,275.00(single) and $24,800.01 to $44,550.00(jointly) 10% tax1/jtax1
$22,275.01 to $52,525.00(single) and $44,550.01 to $105,050.00(jointly) 12% tax2/jtax2
$52,525.01 to $97,925.00(single) and $105,050.01 to $195,850.00(jointly) 22% tax3/jtax3
$97,925.01 to $175,700.00(single) and $195,850.01 to $351,400.00(jointly) 24% tax4/jtax4
$175,700.01 to $219,750.00(single) and $351,400.01 to $439,500.00(jointly) 32% tax5/jtax5
$219,750.01 to $530,800.00(single) and $439,500.01 to $646,850.00(jointly) 35% tax6/jtax6
>$530,800.01(single) and >$646,850.01(jointly) 37% */
const double tax1 = 987.499; const double tax2 = 3629.9988; const double tax3 = 9987.9978; const double tax4 = 18665.9976; // Constant tax rates for single filing
const double tax5 = 14095.9968; const double tax6 = 108867.4965;
const double jtax1 = 1974.999; const double jtax2 = 7259.9988; const double jtax3 = 19975.9978; const double jtax4 = 37321.9976; // Constant tax rates for joint filing
const double jtax5 = 28191.9968; const double jtax6 = 72572.4965;
const double bracket1 = 12400.00; const double bracket2 = 12400.01; // Single bracket constants
const double bracket3 = 22275.00; const double bracket4 = 22275.01;
const double bracket5 = 52525.00; const double bracket6 = 52525.01;
const double bracket7 = 97925.00; const double bracket8 = 97925.01;
const double bracket9 = 175700.00; const double bracket10 = 175700.01;
const double bracket11 = 219750.00; const double bracket12 = 219750.01;
const double bracket13 = 530800.00; const double bracket14 = 530800.01;
const double bracket15 = 24800.00; const double bracket16 = 24800.01; // joint bracket constants
const double bracket17 = 44550.00; const double bracket18 = 44550.01;
const double bracket19 = 105050.00; const double bracket20 = 105050.01;
const double bracket21 = 195850.00; const double bracket22 = 195850.01;
const double bracket23 = 351400.00; const double bracket24 = 351400.01;
const double bracket25 = 439500.00; const double bracket26 = 439500.01;
const double bracket27 = 646850.00; const double bracket28 = 646850.01;
double x, x1, income, otherincome, taxed, efftax; // In between math work
int main()
{
cout << "Are you filing as a single or jointly?" << endl << "1. Single" << endl << "2. Joint" << endl << "Select option: "; cin >> x; // Asks under which filing, they are filing under.
x1 = x;
if (x1 <= 1) {
cout << "Enter income ($): "; cin >> income; // Asks the income then picks the category
if (income <= bracket1)
{
taxed = 0;
efftax = 0;
cout << "Marginal tax rate: 0.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%" << endl << endl;
}
else if (income >= bracket2 && income <= bracket3)
{
taxed = (income - bracket1) * .10;
efftax = (taxed / income) * 100;
cout << "Marginal tax rate: 10.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%" << endl << endl;
}
else if (income >= bracket4 && income <= bracket5)
{
taxed = (income - bracket3) * .12 + tax1;
efftax = (taxed / income) * 100;
cout << "Marginal tax rate: 12.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%" << endl << endl;
}
else if (income >= bracket6 && income <= bracket7)
{
taxed = (income - bracket5) * .22 + tax1 + tax2;
efftax = (taxed / income) * 100;
cout << "Marginal tax rate: 22.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%" << endl << endl;
}
else if (income >= bracket8 && income <= bracket9)
{
taxed = (income - bracket7) * .24 + tax1 + tax2 + tax3;
efftax = (taxed / income) * 100;
cout << "Marginal tax rate: 24.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%" << endl << endl;
}
else if (income >= bracket10 && income <= bracket11)
{
taxed = (income - bracket9) * .32 + tax1 + tax2 + tax3 + tax4;
efftax = (taxed / income) * 100;
cout << "Marginal tax rate: 32.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%" << endl << endl;
}
else if (income >= bracket12 && income <= bracket13)
{
taxed = (income - bracket11) * .35 + tax1 + tax2 + tax3 + tax4 + tax5;
efftax = (taxed / income) * 100;
cout << "Marginal tax rate: 35.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%" << endl << endl;
}
else if (income >= bracket14)
{
taxed = (income - bracket13) * .37 + tax1 + tax2 + tax3 + tax4 + tax5 + tax6;
efftax = (taxed / income) * 100;
cout << "Marginal tax rate: 35.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%" << endl << endl;
}
}
else if (x1 = 2) {
cout << "Enter income ($): "; cin >> otherincome;
}
if (otherincome <= bracket15)
{
taxed = 0;
efftax = 0;
cout << "Marginal tax rate: 0.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%";
}
else if (otherincome >= bracket16 && otherincome <= bracket17)
{
taxed = (otherincome - bracket15) * .10;
efftax = (taxed / otherincome) * 100;
cout << "Marginal tax rate: 10.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << endl << setprecision(3) << "Effective tax rate: " << efftax << "%";
}
else if (otherincome >= bracket18 && otherincome <= bracket19)
{
taxed = (otherincome - bracket17) * .12 + jtax1;
efftax = (taxed / otherincome) * 100;
cout << "Marginal tax rate: 12.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << endl << setprecision(3) << "Effective tax rate: " << efftax << "%";
}
else if (otherincome >= bracket20 && otherincome <= bracket21)
{
taxed = (otherincome - bracket19) * .22 + jtax1 + jtax2;
efftax = (taxed / otherincome) * 100;
cout << "Marginal tax rate: 22.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%";
}
else if (otherincome >= bracket22 && otherincome <= bracket23)
{
taxed = (otherincome - bracket21) * .24 + jtax1 + jtax2 + jtax3;
efftax = (taxed / otherincome) * 100;
cout << "Marginal tax rate: 24.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%";
}
else if (otherincome >= bracket24 && otherincome <= bracket25)
{
taxed = (otherincome - bracket23) * .32 + jtax1 + jtax2 + jtax3 + jtax4;
efftax = (taxed / otherincome) * 100;
cout << "Marginal tax rate: 32.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%";
}
else if (otherincome >= bracket26 && otherincome <= bracket27)
{
taxed = (otherincome - bracket25) * .35 + jtax1 + jtax2 + jtax3 + jtax4 + jtax5;
efftax = (taxed / otherincome) * 100;
cout << "Marginal tax rate: 35.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%";
}
else if (otherincome >= bracket28)
{
taxed = (otherincome - bracket27) * .37 + jtax1 + jtax2 + jtax3 + jtax4 + jtax5 + jtax6;
efftax = (taxed / otherincome) * 100;
cout << "Marginal tax rate: 35.00%"; cout << endl << "Federal taxes due: $" << taxed; cout << setprecision(3) << endl << "Effective tax rate: " << efftax << "%";
}
return 0;
}
| |