Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

3. The United States federal personal income tax is calculated based on filing s

ID: 3888155 • Letter: 3

Question

3. The United States federal personal income tax is calculated based on filing status and taxable income. There are four filing statuses: single filers, married filing jointly or qualified widow(er), married filing separately, and head of household. The tax rates vary every year. The table below shows the rates for 2009. An example is if you are single with a taxable income of $10,000, the first $8,350 is taxed at 10% and the other $1,650 is taxed at 15%, so, your total tax is $1,082.50.

Marriedfiling jointly

or qualifying widow(er)


You are to write a C++ program to compute personal income tax. Your program should prompt the user to enter the filing status and taxable income and compute the tax. Enter 0 for single filers, 1 for married filing jointly or qualified widow(er), 2 for married filing separately, and 3 for head of household. Make sure your program will run for all possible tax situations. Turn in output for the following cases:
Filing Status

0

marginal tax rate single

Marriedfiling jointly

or qualifying widow(er)

Married filing separately Head of household 10% $0-$8350 $0-$16700 $0-$8350 $0-$11950 15% $8351-$33950 $16701-$67900 $8351-$33950 $11951-$45500 25% $33951-$82250 $67901-$137050 $33951-$68525 $45501-$117450 28% $82251-$171550 $137051-$208850 $68526-$104425 $117451-$190200 33% $171551-$372950 $208851-$372950 $104426-$186475 $190201-$$372950 35% $372951+ $372950+ $186476+ $372951+

Explanation / Answer

Hi, here is the complete executable code with comments to help you understand.

#include<iostream>

using namespace std;

int main(void )

{

cout<<"please enter the category of tax filing";

cout<<"enter 0 for single filers"<<endl;

cout<<"enter 1 for married filing jointly or qualified widower"<<endl;

cout<<"enter 2 for married filing separately"<<endl;

cout<<"enter 3 for head of household"<<endl;

int choice;

cin>>choice; //taking choice

int income;

cout<<"enter taxable income"<<endl;

cin>>income;//taking income

/* stroing each choice thresholds in arrays*/

int tenPerecent[4]={8350,16700,8350,11950};

int fifteenPerecent[4]={33950,67900,33950,45500};

int twentyFivePerecent[4]={82250,137050,68525,117450};

int twentyEightPerecent[4]={171550,208850,104425,190200};

int thirtyThreePerecent[4]={372950,372950,186475,372950};

int thirtyFivePerecent[4]={372951,372950,186476,372951};

/* creating max tax arrays for each bracket*/

float fifteenPerecentMAX[4]={0.10*8350,0.10*16700,0.10*8350,0.10*11950};

float twentyFivePerecentMAX[4]={0.15*33950,0.15*67900,0.15*33950,0.15*45500};

float twentyEightPerecentMAX[4]={0.25*82250,0.25*137050,0.25*68525,0.25*117450};

float thirtyThreePerecentMAX[4]={0.28*171550,0.28*208850,0.28*104425,0.28*190200};

float thirtyFivePerecentMAX[4]={0.33*372950,0.33*372950,0.33*186475,0.33*372950};

float totalTax=0.0;

/* checking each bracket and multiplying tax with income minus tax of previous bracket and adding max tax of that bracket */

if(income<=tenPerecent[choice])

{

totalTax+=0.10*income;

}

else if(income<=fifteenPerecent[choice])

{

totalTax+=0.15*abs(income-tenPerecent[choice])+fifteenPerecentMAX[choice];

}

else if(income<=twentyFivePerecent[choice])

{

totalTax+=0.25*abs(income-fifteenPerecent[choice])+twentyFivePerecentMAX[choice];

}

else if(income<=twentyEightPerecent[choice])

{

totalTax+=0.28*abs(income-twentyFivePerecent[choice])+twentyEightPerecentMAX[choice];

}

else if(income<=thirtyThreePerecent[choice])

{

totalTax+=0.33*abs(income-twentyEightPerecent[choice])+thirtyThreePerecentMAX[choice];

}

else

{

totalTax+=0.35*abs(income-thirtyFivePerecent[choice])+thirtyFivePerecentMAX[choice];

}

cout<<totalTax;

  

return 0;

}




Thumbs up if this was helpful, otherwise let me know in comments

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote