-
Notifications
You must be signed in to change notification settings - Fork 0
/
29.rkt
27 lines (20 loc) · 949 Bytes
/
29.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-beginner-reader.ss" "lang")((modname |29|) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
(define COST-PA 1.50) ;cost per attendee
(define PRICE-CHANGE 0.1) ;10-cent change in the ticket price
(define ATT-CHANGE 15) ;average attendance changes by 15 people
(define DEFAULT-PRICE 5.0)
(define DEFAULT-ATT 120)
(define (attendees ticket-price)
(- DEFAULT-ATT (* (- ticket-price DEFAULT-PRICE) (/ ATT-CHANGE PRICE-CHANGE))))
(define (revenue ticket-price)
(* ticket-price (attendees ticket-price)))
(define (cost ticket-price)
(* COST-PA (attendees ticket-price)))
(define (profit ticket-price)
(- (revenue ticket-price)
(cost ticket-price)))
(profit 3)
(profit 4)
(profit 5)