Bifalgorithm post · Computer science one · Life & Taxes
How can PHP conditionals validate income and calculate life and taxes?
How can PHP conditionals validate income and calculate life and taxes? (Computer science one · Life & Taxes) — "38.3.2. Life & Taxes Let’s adapt the conditiona…
Ideas in this flowchart
- PHP script for calculating income tax and child tax credits
- Establish and read the required user inputs
- Read the adjusted gross income as a floating-point value
- Read the number of children as an integer
- Check whether either input is negative
- For invalid inputs, print an error and exit the program
- Calculate the base tax using income-range conditions
- Check income ranges in increasing order using upper bounds
- Apply the formula associated with the matching income bracket
- Compute the child tax credit
- Limit the credit to $3,000 based on the number of children
- Ensure that the credit does not exceed the total tax liability
- Because the credit is non-refundable, the tax cannot become negative