Bifalgorithm post · Computer science one · Quadratic Roots Revisited
How can conditionals prevent a calculated tax liability from becoming negative?
How can conditionals prevent a calculated tax liability from becoming negative? (Computer science one · Quadratic Roots Revisited) — "The tax program uses cond…
Ideas in this flowchart
- PHP tax program calculates base tax, child credit, and final tax liability
- Read the taxpayer’s adjusted gross income
- Read the number of children
- Check whether income and number of children are nonnegative
- Display invalid inputs and terminate the program
- Accept the inputs for tax calculations
- Determine the base tax from the income bracket
- For income up to $18,150, calculate tax at 10%
- For income up to $73,800, calculate $1,815 plus 15% of the excess
- For income up to $148,850, calculate $10,162.50 plus 25% of the excess
- For income up to $225,850, calculate $28,925 plus 28% of the excess
- For income up to $405,100, calculate $50,765 plus 33% of the excess
- For income up to $457,600, calculate $109,587.50 plus 35% of the excess
- For higher income, calculate $127,962.50 plus 39.6% of the excess
- Determine the child credit from the number of children
- For three or fewer children, calculate $1,000 per child
- For more than three children, set the credit to $3,000
- Compare the base tax minus the child credit with zero
- If the difference is nonnegative, set total tax to the difference
- If the difference is negative, set total tax to zero
- Display AGI, base tax, credit, and final tax liability