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

A (mythical) country charges income tax as follows based on one\'s gross salary.

ID: 3648979 • Letter: A

Question

A (mythical) country charges income tax as follows based on one's gross salary. No tax is charged on the first 20% of the salary. The remaining 80% is called taxable income. Tax is paid as follows:
? 10% of the first $15,000 of taxable income;
? 20% on the next $20,000 of taxable income;
? 25% of all taxable income over $35000.
Write a program to read a value for a person's salary and print the amount of tax to be paid and the effective tax rate (percentage of gross salary paid in taxes). The effective tax rate should be shown rounded to the nearest tenth of a percent.

Your output must follow the format shown in the sample execution below. User input is underlined and will, of course, be different each time the program is run.

Enter gross salary: 80000
Amount of tax: 12750
Effective tax rate: 15.9%
---------------------------------------------------------------------------------------------------------
I have no idea on how my teacher got 12750 and effective rate.

int main(void)
{
int salary, no_tax, tax, effective;

printf("Enter gross salary: ");
scanf("%d",&salary);

no_tax = salary*.20;
tax = salary - no_tax;

printf("Amount of tax: %d ", );
printf("Effective tax rate: %d ", effective);
return 0;
}

Explanation / Answer

#include int main(void) { int salary, no_tax, tax,hold; float effective; hold=0; tax=0; printf("Enter gross salary: "); scanf("%d",&salary); no_tax = salary*.20; hold=salary-no_tax; if(hold>15000){ tax+=1500; } else { tax+=hold*.1; } hold-=15000; if(hold>20000){ tax+=4000; } else{ tax+=hold*.2; } hold-=20000; if(hold>0){ tax+=hold*.25; } effective=((float) tax/(float) salary)*100; printf("Amount of tax: %d ", tax); printf("Effective tax rate: %.1f ", effective); return 0; }