Safari F 12:27 AM Tax Documents Undo You are to modify the midterm examination t
ID: 3827337 • Letter: S
Question
Safari F 12:27 AM Tax Documents Undo You are to modify the midterm examination to take advantages of many of the features that we have encountered in chapters 8through 12. The primary objective of the solution remains to compute federal personal income taxes. The solution can have NO global variables. The tax liability depends on how much money one makes as well as their filing status. For our purposes we will use four filing statuses. These are (i)single filers, (2)married filing jointly, (3)married filing separately, and (4)head of household. Tax Single Filers Married Filing Married Filing Head of Jointly Separately 12% Up to S7, 550 Up to S15,100 Up to S7,550 Up to S10,750 16% S7, 551-S30,650 S15,101-S61,300 S7, 551-S30,650 S10,751-S41,050 20% S30,651-S74,200 S61,301-S123,700 S30,651-S61,850 S41,051-S106,000 28% S74,201-S154,8000 S123,701- $61,851-S94,225 $106,001- S188,450 S171,650 32% $154,801- S188,451- S94,226 S168,275 S171,651- S336,550 S336,550 S336,550 40% S336,551 or more S336,551 or more $168,276 or more S336,551 or more For each filing status there are six tax rates. Each rate is applied to a given amount of the taxable income. For example, for a taxable income ofS450,000 for a single filer, $7,550 is taxed at 12%, ($30,650-S7,550) at 16%, (S74,200-S30,650) at 20% (S154,800- $74,200) at 28%, (S336,550-$154,800) at 32%, and (S450,000-336,550) at 40% The six tax rates are to be stored in a one-dimensional array with data type float. The four filing status descriptions are to be stored in a one-dimensional amay of data type string. Variables Name Type Description and edit specifications int StatusCode Status code must be from 1 to 4. 1-single, 2-married filing jointly, 3 married filing separately, 4- head of household, 9-end processing. T 100%Explanation / Answer
Here is the C++ code for you:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int statusCode;
double taxableIncome, taxAmt;
while(true)
{
do
{
cout <<"Enter the status code 1. Single. 2. Married filing jointly. 3. Married filing separately. 4. Head of household. 9. End processing. ";
cout << "Enter your choice: ";
cin >> statusCode;
}while(statusCode != 1 && statusCode != 2 && statusCode != 3 && statusCode != 4 && statusCode != 9);
if(statusCode == 9)
return 0;
do
{
cout <<"Enter your taxable income (>= $3000): ";
cin >> taxableIncome;
}while(taxableIncome < 3000);
switch(statusCode)
{
case 1:
if(taxableIncome >= 0 && taxableIncome <= 7550)
taxAmt = 0.12 * taxableIncome;
else if(taxableIncome > 7550 && taxableIncome <= 30650)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 7550) * 0.04;
else if(taxableIncome > 30650 && taxableIncome <= 74200)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 7550) * 0.04 + (taxableIncome - 30650) * 0.04;
else if(taxableIncome > 74200 && taxableIncome <= 154800)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 7550) * 0.04 + (taxableIncome - 30650) * 0.04 + (taxableIncome - 74200) * 0.08;
else if(taxableIncome > 154800 && taxableIncome <= 336550)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 7550) * 0.04 + (taxableIncome - 30650) * 0.04 + (taxableIncome - 74200) * 0.08 + (taxableIncome - 154800) * 0.04;
else if(taxableIncome > 336550)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 7550) * 0.04 + (taxableIncome - 30650) * 0.04 + (taxableIncome - 74200) * 0.08 + (taxableIncome - 154800) * 0.04 + (taxableIncome - 336550) * 0.08;
cout << "Filing status: Single" << endl;
break;
case 2:
if(taxableIncome >= 0 && taxableIncome <= 15100)
taxAmt = 0.12 * taxableIncome;
else if(taxableIncome > 15100 && taxableIncome <= 61300)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 15100) * 0.04;
else if(taxableIncome > 61300 && taxableIncome <= 123700)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 15100) * 0.04 + (taxableIncome - 61300) * 0.04;
else if(taxableIncome > 123700 && taxableIncome <= 188450)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 15100) * 0.04 + (taxableIncome - 61300) * 0.04 + (taxableIncome - 123700) * 0.08;
else if(taxableIncome > 188450 && taxableIncome <= 336550)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 15100) * 0.04 + (taxableIncome - 61300) * 0.04 + (taxableIncome - 123700) * 0.08 + (taxableIncome - 188450) * 0.04;
else if(taxableIncome > 336550)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 15100) * 0.04 + (taxableIncome - 61300) * 0.04 + (taxableIncome - 123700) * 0.08 + (taxableIncome - 188450) * 0.04 + (taxableIncome - 336550) * 0.08;
cout << "Filing status: Married Filing Jointly" << endl;
break;
case 3:
if(taxableIncome >= 0 && taxableIncome <= 7550)
taxAmt = 0.12 * taxableIncome;
else if(taxableIncome > 7550 && taxableIncome <= 30650)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 7550) * 0.04;
else if(taxableIncome > 30650 && taxableIncome <= 61850)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 7550) * 0.04 + (taxableIncome - 30650) * 0.04;
else if(taxableIncome > 61850 && taxableIncome <= 94225)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 7550) * 0.04 + (taxableIncome - 30650) * 0.04 + (taxableIncome - 61850) * 0.08;
else if(taxableIncome > 94225 && taxableIncome <= 168275)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 7550) * 0.04 + (taxableIncome - 30650) * 0.04 + (taxableIncome - 61850) * 0.08 + (taxableIncome - 94225) * 0.04;
else if(taxableIncome > 168275)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 7550) * 0.04 + (taxableIncome - 30650) * 0.04 + (taxableIncome - 61850) * 0.08 + (taxableIncome - 94225) * 0.04 + (taxableIncome - 168275) * 0.08;
cout << "Filing status: Married Filing Separately" << endl;
break;
case 4:
if(taxableIncome >= 0 && taxableIncome <= 10750)
taxAmt = 0.12 * taxableIncome;
else if(taxableIncome > 10750 && taxableIncome <= 41050)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 10750) * 0.04;
else if(taxableIncome > 41050 && taxableIncome <= 106000)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 10750) * 0.04 + (taxableIncome - 41050) * 0.04;
else if(taxableIncome > 106000 && taxableIncome <= 171650)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 10750) * 0.04 + (taxableIncome - 41050) * 0.04 + (taxableIncome - 106000) * 0.08;
else if(taxableIncome > 171650 && taxableIncome <= 336550)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 10750) * 0.04 + (taxableIncome - 41050) * 0.04 + (taxableIncome - 106000) * 0.08 + (taxableIncome - 171650) * 0.04;
else if(taxableIncome > 336550)
taxAmt = taxableIncome * 0.12 + (taxableIncome - 10750) * 0.04 + (taxableIncome - 41050) * 0.04 + (taxableIncome - 106000) * 0.08 + (taxableIncome - 171650) * 0.04 + (taxableIncome - 336550) * 0.08;
cout << "Filing status: Head of Household" << endl;
break;
case 9: return 0;
}
cout << "Taxable income: $" << fixed << setprecision(2) << taxableIncome << endl;
cout << "Tax amount: $" << fixed << setprecision(2) << taxAmt << endl;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.