[ federal-tax ] 3keep drop
[ fica-tax ] 2keep
medicare-tax + + ;
+
+: total-withholding ( salary w4 tax-table -- x )
+ dup entity>> dup federal = [
+ withholding*
+ ] [
+ drop
+ [ drop <federal> federal withholding* ]
+ [ dup entity>> withholding* ] 3bi +
+ ] if ;
+
+: net ( salary w4 collector -- x )
+ >r dupd r> total-withholding - ;
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors math math.order money ;
+USING: accessors assocs.lib math math.order money ;
IN: taxes.usa.fica
: fica-tax-rate ( -- x ) DECIMAL: .062 ; inline
[ 138 69 ] [
- 24000 2008 2 f <w4> <federal> withholding biweekly dollars/cents
+ 24000 2008 2 f <w4> <federal> total-withholding biweekly dollars/cents
] unit-test
[ 754 72 ] [
- 78250 2008 2 f <w4> <federal> withholding biweekly dollars/cents
+ 78250 2008 2 f <w4> <federal> total-withholding biweekly dollars/cents
] unit-test
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs kernel math math.intervals
-namespaces sequences money math.order taxes.usa.w4
-taxes.usa.federal ;
+namespaces sequences money math.order taxes.usa.w4 ;
IN: taxes.usa
! Withhold: FICA, Medicare, Federal (FICA is social security)
dup entity>> adjust-allowances* ;
: withholding ( salary w4 tax-table -- x )
- dup entity>> federal = [
- dup entity>> withholding*
- ] [
- [ dup entity>> withholding* ]
- [ drop <federal> federal withholding* ] 3bi +
- ] if ;
+ dup entity>> withholding* ;
: tax-bracket-range ( pair -- n ) first2 swap - ;
: marriage-table ( w4 tax-table -- triples )
swap married?>>
[ married>> ] [ single>> ] if ;
-
-: net ( salary w4 collector -- x )
- >r dupd r> withholding - ;