In: Computer Science
Write a program in C++ that asks the user for his/her Taxable Income and displays the Income Tax owed. Use the following table to calculate the Income Tax: Taxable Income Tax Rate
$0 to $9,225 / 10%
$9,226 to $37,450 / $922.50 plus 15% of the amount over $9,225
$37,451 to $90,750 / $5,156.25 plus 25% of the amount over $37,450
$90,751 to $189,300 / $18,481.25 plus 28% of the amount over $90,750
$189,301 to $411,500 / $46,075.25 plus 33% of the amount over $189,300
$411,501 to $413,200 / $119,401.25 plus 35% of the amount over $411,500
$413,201 or more / $119,996.25 plus 39.6% of the amount over $413,200
Explanation:
Here is the code which takes the taxable income from the user and then using if else conditional statements, the tax bracket is identified and then tax is calculated.
Code:
#include <iostream>
using namespace std;
int main()
{
float income;
float tax;
cout<<"Enter taxable income: ";
cin>>income;
if(income<9226)
{
tax = income/10.0;
}
else if(income<37451)
{
tax = 922.50 + (0.15*(income-9225));
}
else if(income<90751)
{
tax = 5156.25 + (0.25*(income-37450));
}
else if(income<189301)
{
tax = 18481.25 + (0.28*(income-90750));
}
else if(income<411501)
{
tax = 46075.25 + (0.33*(income-189300));
}
else if(income<413201)
{
tax = 119401.25 + (0.35*(income-411500));
}
else
{
tax = 119996.25 + (0.396*(income-413200));
}
cout<<"Tax: $"<<tax<<endl;
return 0;
}
Output:
PLEASE UPVOTE IF YOU FOUND THIS HELPFUL!
PLEASE COMMENT IF YOU NEED ANY HELP!