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

Exercise #2: Write a program for the IRS that will calculate income tax. You wil

ID: 3754686 • Letter: E

Question

Exercise #2: Write a program for the IRS that will calculate income tax. You will need as input the person's annual salary. Display a message that says: This year you paid $ tax. So your net salary after taxes are taken out is Format your output to two decimal places dollars in Assume that the tax brackets in the U.S. are as follows: Salary Under $12,000 $12,001-$38,000 $38,001-55,000 Over $55,000 Tax Rate 6% 27% 33% 39% Extra Credit: Modify your program to factor in deductions. Ask the user if he/she has any children. If they do have children, ask them how many, and calculate their new tax amount factoring in a 5% deduction per child off their pre-tax annual salary. Ask the user if he/she makes student loan payments, ask how much interest was paid on the loan last year, and calculate their new tax amount by subtracting the student loan interest from the pre-tax annual salary (after child deduction)

Explanation / Answer

#include <Stdio.h>
#include <conio.h>  
#define MAX_INCOME1 12000
#define MIN_INCOME2 12001
#define MAX_INCOME2 38000
#define TAX_RATE1 0.06
#define MIN_INCOME3 38001
#define MAX_INCOME3 55000
#define TAX_RATE2 0.27
#define MIN_INCOME4 55001
#define TAX_RATE3 0.33
#define TAX_RATE4 0.39
#define TAX_RATE5 0.05
main()
{
double income, taxable_income,tax;
char result, result1;
int n,interest;
clrscr ();
printf(" Enter the income: ");
scanf ("%lf", &income) ;
printf("Do you have children?(Y/N)");
scanf("%c",&result);
if(result=='Y')
{ printf("How many?");
scanf("%d",&n);
tax = (income) *TAX_RATE1;
}

taxable_income = income - 12000;
if(taxable_income <= 0)
{
tax = (income - MAX_INCOME1) *TAX_RATE1;
}
else if(taxable_income >= MIN_INCOME2 && taxable_income < MAX_INCOME2)
{
tax = (taxable_income - MIN_INCOME2) *TAX_RATE2;
}
else if(taxable_income >= MIN_INCOME3 && taxable_income < MAX_INCOME3)
{
tax = (taxable_income - MIN_INCOME3) * TAX_RATE3;
}
else
{
tax = (taxable_income - MIN_INCOME4) * TAX_RATE4;
}
printf("This year you paid $%lf dollars in tax", &income);
printf(" So your net salary after taxes are taken out is $= %lf", tax);

printf("Do you make student loan payments?(Y/N)");
scanf("%c",&result1);
if(result1=='Y')
{ printf("How much interest was paid on the loan last year?");
scanf("%d",&interest);
new_tax = (income) -interest;
}
getch();
return 0;
}