home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / ckscripts / income_tax < prev    next >
Text File  |  2020-01-01  |  767b  |  31 lines

  1. #!/usr/local/bin/kermit
  2.  
  3. ; i n c o m e _ t a x  --  Sample income bracketed tax calculation
  4. ;
  5. ; Author:  Dat Thuc Nguyen, 24 Sep 2001
  6. ;
  7. ; Adapted from:
  8. ; http://www.scheme.com/tspl2d/
  9. ;
  10. ; \%1 Income
  11. ;
  12. define income_tax {
  13.     if < \v(argc) 2 exit 1 Usage: income_tax income
  14.     if not float \%1 exit 1 \%1: not a number
  15.     if < \%1 0 .\%1 = 0
  16.     (if (<= \%1 10000) (* \%1 .05)
  17.         (if (<= \%1 20000) (+ (* (- \%1 10000) .08) 500.00)
  18.             (if (<= \%1 30000) (+ (* (- \%1 20000) .13) 1300.00)
  19.                 (+ (* (- \%1 30000) .21)  2600.00)
  20.             )
  21.         )
  22.     )
  23. }
  24.  
  25. echo \fsexpr(income_tax 5000)   ; => 250.0
  26. echo \fsexpr(income_tax 15000)  ; => 900.0
  27. echo \fsexpr(income_tax 25000)  ; => 1950.0
  28. echo \fsexpr(income_tax 50000)  ; => 6800.0
  29.  
  30. exit
  31.