/* lab3-4a.java Lab 3: Data Definitions with Containment Start by looking at the classes in the textbook that represent the the clock time. The ClockTime class is defined on page 21. Open the file lab3-4.java and in the Examples class make examples of the ClockTime data as follows: -- the time is 8:15 in the morning -- the time is 4:35 in the afternoon -- Make two examples of {\tt{ClockTime}} data and ask your partner to tell what time do these examples represent. */ /* +------------+ | ClockTime | +------------+ | int hour | | int minute | +------------+ */ // to represent the time of day class ClockTime { int hour; int minute; ClockTime(int hour, int minute) { this.hour = hour; this.minute = minute; } } /* ;; Data definitions ;; A Radio Show (Show) is make-rs String ClockTime ClockTime (define-struct show (name start finish)) (define news (make-show "news" ...)) (define game (make-show "game" ...)) */ /* +------------------+ | Show | +------------------+ | String name | | ClockTime start | | ClockTime finish | +------------------+ */ // to represent a radio show class Show { String name; ClockTime start; ClockTime finish; Show(String name, ClockTime start, ClockTime finish) { this.name = name; this.start = start; this.finish = finish; } } /* Make examples of two radio shows: a news show that starts at 7:00 pm and runs for 30 minutes, a game show that starts at 10:00 am and runs for an hour. */ class Examples { Examples() {} // Examples for the class ClockTime ClockTime ct08hr15min = new ClockTime(8, 15); ClockTime ct16hr35min = new ClockTime(16, 35); ClockTime ct09hr50min = new ClockTime(9, 50); ClockTime ct19hr00min = new ClockTime(19, 0); Show news = new Show("News", this.ct19hr00min, new ClockTime(19, 30)); Show millionaire = new Show("Millionaire", new ClockTime(10, 0), new ClockTime(11, 0)); } /* +------------------+ | Show | +------------------+ | String name | | ClockTime start |----+ | ClockTime finish |-+ | +------------------+ | | | | v v +------------+ | ClockTime | +------------+ | int hour | | int minute | +------------+ */