Pad 10:50 PM Documents Undo You are to write a C++ program to compute federal pe
ID: 3863856 • Letter: P
Question
Pad 10:50 PM Documents Undo You are to write a C++ program to compute federal personal income taxes. Program is to have no global variables. Use the concepts we have encountered in the first seven chapters. You are not to use functions, enums, arrays, structs, classes, or pointers. The tax owned depends on how much money one makes as well as their filing status. For use four filing statuses. These are ()single filers, (2)married filing our purposes we wi inintlv Rhmarried filino senaratelv and u4hhead nf hem erhald Tax Single Filers Married Filing Married Filing Head of Jointly Separately 2 12% Up to S7,550 Up to S15.100 Up to S7,550 Up to S10,750 3 16% S7.551-S30,650 S15,101-S61,300 S7,551-S30,650 S10,751-S41,050 4 20% S30,651-S74,200 S61,301-S123,700 S30,651-S61,850 S41,051-S106,000 28% S74, 201-S154,800 S123,701- $61,851-S94.225 S106,001- S171,650 S188,450 32% S154,801- S188,451- $94,226 S168,275 S171,651- S336,550 S336,550 S336,550 7 40% S336,551 or more S336,551 or more S168,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 of S450,000 for a single filer, S7,550 is taxed at 12%, ($30,650-S7,550) at 16%, (S74,200-S30,650) at 20% (S154,800- S74,200) at 28%, (S336,550-$154.800) at 32%, and (S450,000-336,550) at 40% for a tax amount of S139,419. Variables Name Type Description and edit specifications status Code int Status code must be from l to 4. l single, 2 married filing jointly, 3 married filing separately, 4 head of household, 9-end processing. taxable Income float Taxable income is entered by the user from the keyboard. The amount must be numeric and not less than S3000. tax Amt is a calculated field and is determined from the supplied tax table as applied to the taxablelncome. 75%Explanation / Answer
#include <iostream>
using namespace std;
int main() {
// variables declaration
int statusCode;
float taxableIncome;
float taxAmt;
// statusCode input reading
do
{
cout<<"Please Enter a valid statusCode ";
cout<<"Enter 1 for Single Filing ";
cout<<"Enter 2 for Married Filing Jointly ";
cout<<"Enter 3 for Married Filing Separately ";
cout<<"Enter 4 for Head of Household ";
cout<<"Enter 9 for End Processing ";
cin>>statusCode;
switch(statusCode)
{
case 1:
//code for single filing
cout<<"Enter taxableIncome:";
cin>>taxableIncome;
if(taxableIncome<3000)
cout<<"Enter amount not less than $3000";
else
{
if(taxableIncome <= 7550)
{
taxAmt = taxableIncome + 0.12 * taxableIncome;
}
if(taxableIncome >7550 && taxableIncome <=30650)
{
taxAmt = taxableIncome + 0.16 * taxableIncome;
}
if(taxableIncome >30650 && taxableIncome <=74200)
{
taxAmt = taxableIncome + 0.20 * taxableIncome;
}
if(taxableIncome >74200 && taxableIncome <=154800)
{
taxAmt = taxableIncome + 0.28 * taxableIncome;
}
if(taxableIncome >154800 && taxableIncome <=336550)
{
taxAmt = taxableIncome + 0.32 * taxableIncome;
}
if(taxableIncome >336550)
{
taxAmt = taxableIncome + 0.40 * taxableIncome;
}
cout<<"Filing Status : Single Filing";
cout<<" Taxable Income : $"<<taxableIncome;
cout<<" Tax Amount : $"<<taxAmt;
}
case 2:
//code for Married filing jointly
cout<<"Enter taxableIncome:";
cin>>taxableIncome;
if(taxableIncome<3000)
cout<<"Enter amount not less than $3000";
else
{
if(taxableIncome <= 15100)
{
taxAmt = taxableIncome + 0.12 * taxableIncome;
}
if(taxableIncome >15100 && taxableIncome <=61300)
{
taxAmt = taxableIncome + 0.16 * taxableIncome;
}
if(taxableIncome >61300 && taxableIncome <=123700)
{
taxAmt = taxableIncome + 0.20 * taxableIncome;
}
if(taxableIncome >123700 && taxableIncome <=188450)
{
taxAmt = taxableIncome + 0.28 * taxableIncome;
}
if(taxableIncome >188450 && taxableIncome <=336550)
{
taxAmt = taxableIncome + 0.32 * taxableIncome;
}
if(taxableIncome >336550)
{
taxAmt = taxableIncome + 0.40 * taxableIncome;
}
cout<<"Filing Status : Married Filing Jointly";
cout<<" Taxable Income : $"<<taxableIncome;
cout<<" Tax Amount : $"<<taxAmt;
}
case 3:
//code for Married filing Separately
cout<<"Enter taxableIncome:";
cin>>taxableIncome;
if(taxableIncome<3000)
cout<<"Enter amount not less than $3000";
else
{
if(taxableIncome <= 7550)
{
taxAmt = taxableIncome + 0.12 * taxableIncome;
}
if(taxableIncome >7550 && taxableIncome <=30650)
{
taxAmt = taxableIncome + 0.16 * taxableIncome;
}
if(taxableIncome >30650 && taxableIncome <=61850)
{
taxAmt = taxableIncome + 0.20 * taxableIncome;
}
if(taxableIncome >61850 && taxableIncome <=94225)
{
taxAmt = taxableIncome + 0.28 * taxableIncome;
}
if(taxableIncome >94225 && taxableIncome <=168275)
{
taxAmt = taxableIncome + 0.32 * taxableIncome;
}
if(taxableIncome >168275)
{
taxAmt = taxableIncome + 0.40 * taxableIncome;
}
cout<<"Filing Status : Married Filing Separately";
cout<<" Taxable Income : $"<<taxableIncome;
cout<<" Tax Amount : $"<<taxAmt;
}
case 4:
//code for Head of Household filing
cout<<"Enter taxableIncome:";
cin>>taxableIncome;
if(taxableIncome<3000)
cout<<"Enter amount not less than $3000";
else
{
if(taxableIncome <= 10750)
{
taxAmt = taxableIncome + 0.12 * taxableIncome;
}
if(taxableIncome >10750 && taxableIncome <=41050)
{
taxAmt = taxableIncome + 0.16 * taxableIncome;
}
if(taxableIncome >41050 && taxableIncome <=106000)
{
taxAmt = taxableIncome + 0.20 * taxableIncome;
}
if(taxableIncome >106000 && taxableIncome <=171650)
{
taxAmt = taxableIncome + 0.28 * taxableIncome;
}
if(taxableIncome >171650 && taxableIncome <=336550)
{
taxAmt = taxableIncome + 0.32 * taxableIncome;
}
if(taxableIncome >336550)
{
taxAmt = taxableIncome + 0.40 * taxableIncome;
}
cout<<"Filing Status : Head of Household";
cout<<" Taxable Income : $"<<taxableIncome;
cout<<" Tax Amount : $"<<taxAmt;
}
case 9:
return 0;
default:
cout<<"Enter a valid statusCode";
}
}while((statusCode == 1)|| (statusCode == 2)||(statusCode == 3)||(statusCode == 4)||(statusCode == 9));
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.