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 a person\'s net sala

ID: 638670 • Letter: A

Question

A (mythical) country charges income tax as follows based on a person's net salary , which is the gross salary minus $1000 for each dependent. No tax is charged on the first 15% of the net salary. The remaining 85% is called the 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;
? 30% of all taxable income over $35000.
The effective tax rate is defined to be the percentage of gross income to be paid in taxes.
You are to write a program for a tax consultant to process the tax information of the consultant's clients. Your program will be run in "batch mode", that is, with input coming from a file via input redirection. Thus no prompts are needed. The program first inputs the number of clients. Then, for each client, inputs the client ID number, the gross salary and number of dependents and prints the client ID, the amount of the tax and the effective tax rate. No input validation is to be done.
The information for each client will be printed on one line as shown in the example below. The tax should be rounded to whole dollars and 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. Contents of the client information file:
Output:
135 15400 18.8
136 4280 11.6
To test your program, enter the values as shown in the example and see if the output matches the output shown above.
2
135
82000
2
136
37000
3

Explanation / Answer

#include <stdio.h>
int main() {
double income, tax;

/* get the income from the user */
printf("Enter your income:");
scanf("%lf", &income);

/* calculate the income tax */
if (income > 800000) {
tax = 92000 + ((income - 180000) * 30)/100;
} else if (income > 500000) {
tax = 32000 + ((income - 180000) * 20)/100;
} else if (income > 180000) {
tax = ((income - 180000) * 10)/100;
} else {
tax = 0;
}

/* print the result */
printf("Income tax for %.2lf is %.2lf ", income, tax);
return 0;
}