formula - Algorithm for this format -


i trying develop program compute tax given base salary, believe given format of income tax table have, there should formula or algorithm calculate tax given base salary. below sample format of income tax table. can lookups think algorithm or formula might best approach.

annual salary   monthly    ranges   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   .....  27,960.00       2,325.01        2,330.00    41.50 --last line of first format   28,020.00       2,330.01        2,335.00    41.83 -- start of second format  28,080.00       2,335.01        2,340.00    42.33   28,140.00       2,340.01        2,345.00    42.83  

i able find formula first part , working find in program can't make second part work.

the formula first part below :

the tax 0.25 on every 5.00 or portion above 1500. using

ceil((monthly−1500)/5) * 0.25 

i have tried similar methods second pattern not working far

it seems want offset number, 41.33.

41.33 + ceil((monthly − 2330) / 5) * 0.5 

although seems better solution: (considering might least effort deal new versions of it)

  • reading data in in automated way
  • doing binary search range salary falls under
  • look tax due

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -