;; The first three lines of this file were inserted by DrScheme. 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 lab3-1a) (read-case-sensitive #t) (teachpacks ((lib "world.ss" "teachpack" "htdp") (lib "testing.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "world.ss" "teachpack" "htdp") (lib "testing.ss" "teachpack" "htdp"))))) ;; lab3-1a.ss ;; Consider the following problem. We are given information about a ;; radio show: name, total running time in minutes, and a list of ads ;; to run during the show, where for each ad we were given its name, ;; the running time in minutes and the profit it generates in dollars. ;; ;; Here are the data definitions as we have learned them in HtDP: ;; Data definitions ;; A Radio Show (Show) is make-rs String Number [Listof Ad] (define-struct show (name minutes ads)) ;; An Ad is (make-ad String Number Number) (define-struct ad (name minutes profit)) ;; Examples of data: (define ipod-ad (make-ad "ipod" 2 100)) (define ms-ad (make-ad "ms" 1 500)) (define xbox-ad (make-ad "xbox" 2 300)) (define news-ads (list ipod-ad ms-ad ipod-ad xbox-ad)) (define game-ads (list ipod-ad ms-ad ipod-ad ms-ad xbox-ad ipod-ad)) (define bad-ads (list ipod-ad ms-ad ms-ad ipod-ad xbox-ad ipod-ad)) (define news (make-show "news" 60 news-ads)) (define game (make-show "game" 120 game-ads)) ;; Identify the examples that represent the following ;; information: ;; ;; an iPod ad that lasts 2 minutes and brings in \$100 profit. ;; ;; an MS ad that lasts 1 minute and brings in \$500 profit. ;; ;; an XBox ad that lasts 2 minutes and brings in \$300 profit. ;; ;; a news show that runs the ads for iPod, MS, iPod again, and ;; XBox and lasts 60 minutes. ;; ;; a game show that lasts 120 minutes and runs the ads for iPod, ;; MS, iPod and MS again, then XBox.