On Mon, Jan 3, 2011 at 1:19 AM, Stephen Bloch <[email protected]> wrote:

>
> > ; net-pay: number -> number
> > ; given gross pay, produces net pay
> > (define (net-pay gross-pay)
> >  (- gross-pay (tax gross-pay)))
> >
> > Ah okay, I was using hours as the only user input to have a whole
> function calculate netpay of one input.
>
> Yes, you should still do that.  The above is just a helper function (like
> "pay"); it's not the function you tell the users about.  Perhaps a better
> name for it would be "deduct-tax", leaving the original name "net-pay" free
> to be used for the function that takes in hours and returns net pay.
>
> Stephen Bloch
> [email protected]
>


Unfortunately I think I must be blind to this solution, I have done the
exercises after and had no problem. I have re-writeen this one too many
times I have lost focus.

This is where I was embedding a function again.


(define (gross hours)
  (* 12 hours ))
(define (pay (gross hours))
  (cond
    [(>= gross 480) (+(*(- gross 480)0.28)36)]
    [(>= gross 240) (*(- gross 240)0.15)]
    [(< gross 240) 0]))
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to