taxes to store the total taxes calculated.prev to keep track of the upper limit of the previous bracket, starting at 0.brackets array.
a. Calculate the taxable income for the current bracket as the minimum of the difference between the current bracket's upper limit and prev, and the remaining income.
b. Calculate the taxes for the current bracket by multiplying the taxable income by the current bracket's tax rate.
c. Add the calculated taxes to the total taxes.
d. Subtract the taxable income from income to update the remaining income to be taxed.
e. Update prev to the current bracket's upper limit.
f. If the remaining income is 0 or less, break out of the loop.taxes calculated.