#reader(lib "htdp-beginner-reader.ss" "lang")((modname dish-order-cost-struct) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
(define-struct dish (name price mintemp maxtemp))
(define dish1 (make-dish "Haggis" 12 100 150))
(define dish2 (make-dish "Gnocchi" 7 110 140))
(define dish3 (make-dish "Pie" 5 40 50))
(define dish4 (make-dish "Hummus" 5 60 80))
(define-struct order (appetizer entree dessert))
(define order1 (make-order dish4 dish1 dish3))
(define order2 (make-order dish4 dish2 dish3))
(check-expect (order-cost order1) 25.96)
(check-expect (order-cost order2) 20.06)
(define (order-cost an-order)
(* 1.18 ( + (dish-price (order-appetizer an-order))
(dish-price (order-entree an-order))
(dish-price (order-dessert an-order)) )))
(require (planet nah22/racketui))
(define/web dish/web
(structure make-dish
["Name" string+]
["Price" number]
["Minimum serving temperature" number]
["Maximum serving temperature" number]))
(define/web order/web
(structure make-order
["Appetizer" dish/web]
["Entree" dish/web]
["Dessert" dish/web]))
(web-launch "Order Cost"
(function "Computes the total cost of the order including gratuity"
(order-cost ["The order" order/web] -> ["Order total" number])))