Formula for this pattern

112 Views Asked by At

I am trying to develop a computer program to compute the tax for a given base salary, I believe given the format of the income tax table that I have there should be a formula to calculate the tax for a given base salary. Below is the sample format of income tax table.

 Annual Salary   Monthly From    Ranges To   Tax Due
 18,000.00       0.00            1,500.00    0.00
 18,060.00       1,500.01        1,505.00    0.25 
 18,120.00       1,505.01        1,510.00    0.50 
 18,180.00       1,510.01        1,515.00    0.75 
 18,240.00       1,515.01        1,520.00    1.00 
 18,300.00       1,520.01        1,525.00    1.25 
 18,360.00       1,525.01        1,530.00    1.50 

As you can see for every range of salary there is an increment of .25 on tax. I have tried to find my own formula but I could not find an accurate one.

1

There are 1 best solutions below

6
On BEST ANSWER

Your tax is $0.25$ on every $5.00$ or portion above $1500$. So you can use $\lceil \frac {\text{monthly}-1500} 5 \rceil \cdot 0.25$