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

Build a program based on the following scenario: The United States federal perso

ID: 3799826 • Letter: B

Question

Build a program based on the following scenario:

The United States federal personal income tax is calculated based on filing status and taxable income. There are two filing statuses: single and married. Table below shows the tax rates. If you are, say, single with a taxable income of $50,000, the first $30,000 is taxed at 10% and other $20,000 is taxed at 20%, so, your total tax is $7,000.

Tax Rate

Single

Married

10%

$0 - $30,000

$0 - $50,000

20%

$30,001 - $80,000

$50,001 - $100,000

35%

< $80,000

<$100,000

Write a program that displays a menu allowing the user to select one of these two filing statuses (single = 1, married = 2). After a selection has been made, the user should enter the amount of taxable income. The program should then compute tax and display filing status, taxable income, and tax amount.

Input Validation: check that the user has selected one of the available menu choices. If not, display error message and ask to enter 1 or 2.

Tax Rate

Single

Married

10%

$0 - $30,000

$0 - $50,000

20%

$30,001 - $80,000

$50,001 - $100,000

35%

< $80,000

<$100,000

Explanation / Answer

#include <iostream>

using namespace std;

int main()
{
int choice;
double income;
int taxRate;
cout << "Enter the status: 1. single 2. married" << endl;
cin >> choice;
cout<<"Enter the amount of taxable income: ";
cin >> income;
if(choice == 1){
if( income <= 30000){
taxRate = 10;
}
else if( income > 30000 && income <=80000){
taxRate = 20;
}
else{
taxRate = 35;
}
cout<<"Filing status is singe"<<endl;
cout<<"Taxable amount: "<<income<<endl;
cout<<"Tax rate: "<<taxRate<<endl;
cout<<"Tax amount: "<<(income * taxRate)/100<<endl;
}

else if(choice == 2){

if( income <= 50000){
taxRate = 10;
}
else if( income > 50000 && income <=100000){
taxRate = 20;
}
else{
taxRate = 35;
}
cout<<"Filing status is married"<<endl;
cout<<"Taxable amount: "<<income<<endl;
cout<<"Tax rate: "<<taxRate<<endl;
cout<<"Tax amount: "<<(income * taxRate)/100<<endl;
}
else{
cout<<"Invalid chice. Must enter 1 or 2."<<endl;
}

return 0;
}

Output:

sh-4.2$ g++ -o main *.cpp                                                                                                                                                                                                                                                

sh-4.2$ main                                                                                                                                                                                                                                                             

Enter the status:                                                                                                                                                                                                                                                        

1. single                                                                                                                                                                                                                                                                

2. married                                                                                                                                                                                                                                                               

1                                                                                                                                                                                                                                                                        

Enter the amount of taxable income: 66000                                                                                                                                                                                                                                

Filing status is singe                                                                                                                                                                                                                                                   

Taxable amount: 66000                                                                                                                                                                                                                                                    

Tax rate: 20                                                                                                                                                                                                                                                             

Tax amount: 13200                                                                                                                                                                                                                                                        

sh-4.2$ main                                                                                                                                                                                                                                                             

Enter the status:                                                                                                                                                                                                                                                        

1. single                                                                                                                                                                                                                                                                

2. married                                                                                                                                                                                                                                                               

2                                                                                                                                                                                                                                                                        

Enter the amount of taxable income: 66000                                                                                                                                                                                                                                

Filing status is married                                                                                                                                                                                                                                                 

Taxable amount: 66000                                                                                                                                                                                                                                                    

Tax rate: 20                                                                                                                                                                                                                                                             

Tax amount: 13200   

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