/* lab3-5a.java +-------------+ | Ad | +-------------+ / \ --- | ------------------- | | +-------------+ +-------------+ | Commercial | | Service | +-------------+ +-------------+ | String name | | String name | | int minutes | | int minutes | | int profit | +-------------+ +-------------+ */ // to represent an ad within a radio show interface Ad{ } // to represent a commercial ad within a radio show class Commercial implements Ad { String name; int minutes; int profit; Commercial(String name, int minutes, int profit) { this.name = name; this.minutes = minutes; this.profit = profit; } } // to represent a service ad within a radio show class Service implements Ad { String name; int minutes; Service(String name, int minutes) { this.name = name; this.minutes = minutes; } } // examples for the class hierarchy that represents radio ads class Examples{ Examples(){} // (define ipod-ad (make-ad "ipod" 2 100)) Ad ipodAd = new Commercial("ipod", 2, 100); // (define ms-ad (make-ad "ms" 1 500)) Ad msAd = new Commercial("ms", 1, 500); // (define xbox-ad (make-ad "xbox" 2 300)) Ad xboxAd = new Commercial("xbox", 2, 300); // (define heart (make-service "heart-assoc" 1)) Ad heart = new Service("heart-assoc", 1); // (define youth (make-service "youth-prog" 2)) Ad youth = new Service("youth-prog", 2); }