← Back to If Statements
Question 251
Progressive Tax
Progressive Tax
The variable income is a yearly income in dollars. Tax is progressive: the first 10000 is tax free, the part from 10000 up to 40000 is taxed at 10 percent, and everything above 40000 is taxed at 20 percent. Use an if / else if / else chain to compute the tax into a variable called tax, remembering that a high earner still pays the lower rate on the lower band, then print Tax: <tax>.Expected Output:
Tax: 4000= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
If Statements
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.