You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »


;; contract:
;; owe: nat -> num
;; purpose:
;; (owe n) returns how much money you owe for
;;   eating n slices of pizza where the pizza 
;;   costs $12
;;   and there are 8 slices per pizza.
;;
;; Examples: 
(check-expect (owe 4) 6)
(check-expect (owe 15) 22.5)
(check-expect (owe 0) 0)
(check-expect (owe 8) 12)
;; definition:
(define (owe slices) 
  (* slices (/ 12 8)))

  
  • No labels