[racket] exercise problem

From: Roelof Wobben (r.wobben at home.nl)
Date: Wed Feb 1 13:55:59 EST 2012


I have this problem :

Utopia's tax accountants always use programs that compute income taxes
even though the tax rate is a solid, never-changing 15%. Define the
program tax, which determines the tax on the gross pay.

Also define netpay. The program determines the net pay of an employee
from the number of hours worked. Assume an hourly rate of $12.

So in my opion I can solve this at this way :

grosspay = hours_work * 12,5
tax = grosspay * 0,15
netpay = grosspay - tax.

So I did this :

(define (grosspay h)
    (* h 12.50))

(define (tax grosspay)
     ( * grosspay 0.15))

(define (nettoloon grosspay tax)
      (- grosspay tax))

But when I do :

(grosspay 1) I get a message that there a 2 variables and one is given.
So the other functions are not executed.

What's the right way to solve this problem.


Posted on the users mailing list.