[racket] Solved Re: Order of Operations - Getting the brackets.
Sayth Renshaw <flebber.crue at ...> writes:
>
> What I am having trouble navigating is the brackets.Simply in normal math what
I am trying to do is(people * ticket price)-((number of shows * 20)+(people *
cost per person))Contrcat : total profit : attendees performance -> number;;
Purpose to calculate total profit of a theatre per show ;;Example: (total profit
20 1) should produce $70;;Defintion: ( define (- profit cost))(* patrons 5( - (*
patrons 0.5(+ (* shows 20)))))(define (patrons p) ;p a number ...
) (define (shows s) ;s a number ... ) (define
(total_profit p s) (* p 5( - (* p 0.5(+ s 20)))))
>
Took a little bit of tooling but got the brackets right
(define (patrons p)
;p a number
...
)
(define (shows s)
;s a number
...
)
(define (total_profit p s)
(- (* p 5)
(+ (* s 20)(* p 0.5))))