1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors arrays assocs kernel math math.intervals
4 namespaces sequences money math.order taxes.usa.fica
5 taxes.usa.medicare taxes.usa taxes.usa.w4 ;
8 ! http://www.irs.gov/pub/irs-pdf/p15.pdf
9 ! Table 7 ANNUAL Payroll Period
11 : federal-single ( -- triples )
14 { 2650 10300 DECIMAL: .10 }
15 { 10300 33960 DECIMAL: .15 }
16 { 33960 79725 DECIMAL: .25 }
17 { 79725 166500 DECIMAL: .28 }
18 { 166500 359650 DECIMAL: .33 }
19 { 359650 1/0. DECIMAL: .35 }
22 : federal-married ( -- triples )
25 { 8000 23550 DECIMAL: .10 }
26 { 23550 72150 DECIMAL: .15 }
27 { 72150 137850 DECIMAL: .25 }
28 { 137850 207700 DECIMAL: .28 }
29 { 207700 365100 DECIMAL: .33 }
30 { 365100 1/0. DECIMAL: .35 }
34 : <federal> ( -- obj )
35 federal federal-single federal-married <tax-table> ;
37 : federal-tax ( salary w4 tax-table -- n )
38 [ adjust-allowances ] 2keep marriage-table tax ;
40 M: federal adjust-allowances* ( salary w4 collector entity -- newsalary )
41 2drop calculate-w4-allowances - ;
43 M: federal withholding* ( salary w4 tax-table entity -- x )
45 [ federal-tax ] 3keep drop