Bifalgorithm post · Computer science one · Quadratic Roots Revisited
How can conditionals calculate tax brackets, credits, and total tax?
How can conditionals calculate tax brackets, credits, and total tax? (Computer science one · Quadratic Roots Revisited) — "16.3. Examples\n\n1 if(baseTax - cre…
Ideas in this flowchart
- Code Sample 16.3: A C program that calculates total tax liability
- The program reads adjusted gross income and the number of children from the user.
- Are the income and number-of-children inputs nonnegative?
- Negative inputs are reported as invalid, and the program exits.
- Nonnegative inputs are accepted for further tax calculation.
- Base tax is calculated using seven income brackets, from 10% below $18,150 to 39.6% above $457,600.
- Are there three or fewer children?
- The child credit equals the number of children multiplied by $1,000.
- For more than three children, the credit is capped at $3,000.
- Is the base tax at least as large as the child credit?
- Total tax equals base tax minus the credit.
- If the credit exceeds the base tax, total tax is set to zero.
- The program prints income, base tax, credit, and final tax liability.