/* lab3-2a.java ;; 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)) */ /* +-------------+ | Ad | +-------------+ | String name | | int minutes | | int profit | +-------------+ */ // to represent an ad within a radio show class Ad { String name; int minutes; int profit; Ad(String name, int minutes, int profit) { this.name = name; this.minutes = minutes; this.profit = profit; } } // examples for the class Ad class Examples{ Examples(){} // (define ipod-ad (make-ad "ipod" 2 100)) Ad ipodAd = new Ad("ipod", 2, 100); // (define ms-ad (make-ad "ms" 1 500)) Ad msAd = new Ad("ms", 1, 500); // (define xbox-ad (make-ad "xbox" 2 300)) Ad xboxAd = new Ad("xbox", 2, 300); }