sample output Enter the annual income: 0 Invalid income, enter the income again:
ID: 641356 • Letter: S
Question
sample output
Enter the annual income: 0
Invalid income, enter the income again: 0
Invalid income, enter the income again: 0
Invalid income, enter the income again: -1
Invalid income, enter the income again: 75650.55
Enter the base tax rate: 0
Invalid tax rate, enter the tax rate again: 31
Invalid tax rate, enter the tax rate again: 9
Invalid tax rate, enter the tax rate again: 10
Your tax rate is: 20%
You pay $15130.11 in taxes.
After taxes your net income is: $60520.44
Do you want to continue (0: exit 1:continue):1
Enter the annual income: 125675.99
Enter the base tax rate: -9
Invalid tax rate, enter the tax rate again: 45
Invalid tax rate, enter the tax rate again: 25
Your tax rate is: 45% You pay $56554.20 in taxes.
After taxes your net income is: $69121.80
Do you want to continue (0:exit 1:continue): 1
Enter the annual income: 0
Invalid income, enter the income again: 0
Invalid income, enter the income again: -1
Invalid income, enter the income again: 555000
Enter the base tax rate: 15
Your tax rate is: 45% You pay $249750.02 in taxes.
After taxes your net income is: $305250.00
Do you want to continue (0:exit 1:continue): 0
The highest tax paid is 249750.02
The lowest tax paid is 15130.11
The average tax paid is 107144.77
Explanation / Answer
Code in C language...
#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;
}
Answer using Java programming language ....
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.