Blob


1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 ;; about the language level of this file in a form that our tools can easily process.
3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname |3.14|) (read-case-sensitive #t) (teachpacks ((lib "convert.ss" "teachpack" "htdp"))) (htdp-settings #8(#t constructor repeating-decimal #f #t none #f ((lib "convert.ss" "teachpack" "htdp")))))
4 ;; profit : number -> number
5 ;; Calculates profit as a difference between profit and revenue depending on the ticket-price
7 (define (profit ticket-price)
8 (- (revenue ticket-price) (costs ticket-price)))
10 ;; revenue : number -> number
11 ;; Calculates revenue, which is given as the ticket-price times the number of attendees.
13 (define (revenue ticket-price)
14 (* ticket-price (attendees ticket-price)))
16 ;; costs : number -> number
17 ;; Calculates costs, which has a fixed cost plus a variable cost that depends on the ticket-price
19 (define (costs ticket-price)
20 (* 1.50 (attendees ticket-price)))
22 ;; attendees : number -> number
23 ;; Calculates the number of attendees as a function of the ticket price
24 ;; Example: (attendees 5) should give 120
25 ;; Example: (attendees 4) should give 270
26 ;; Example: (attendees 3) should give 420
28 (define (attendees ticket-price)
29 (+ 120 (* (/ (- 5 ticket-price) 0.1) 15)))