/* lab3-4b.java ;; A ClockTime is (make-ctime Number Number) (define-struct ctime (hours minutes)) (define ct08hr15min (make-ctime 8 15)) (define ct16hr35min (make-ctime 16 35)) (define ct09hr50min (make-ctime 9 50)) (define ct19hr00min (make-ctime 19 0)) ;; A Picture is (make-pic String Number Number Number String) (define-struct photo (name width height bytes kind)) (define river (make-photo "River" 3456 2304 3614571 "jpeg")) (define mountain (make-photo "Mountain" 2448 3264 1276114 "jpeg")) (define people (make-photo "People" 545 641 13760 "gif")) (define plt-icon (make-photo "PLT icon" 16 16 1334 "bmp")) */ /* +----------------+ | Photo | +----------------+ | String name | | int width | | int height | | int bytes | | String kind | | ClockTime time | +----------------+ */ // to represent a photo in an iPhoto collection class Photo{ String name; int width; int height; int bytes; String kind; ClockTime time; Photo(String name, int width, int height, int bytes, String kind, ClockTime time){ this.name = name; this.width = width; this.height = height; this.bytes = bytes; this.kind = kind; this.time = time; } } /* +------------+ | 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; } } // examples of the classes ClockTima and Photo 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); // (define river (make-photo "River" 3456 2304 3614571 "jpeg")) // - at 8:15 am Photo river = new Photo("River", 3456, 2304, 3614571, "jpeg", this.ct08hr15min); // (define mountain (make-photo "Mountain" 2448 3264 1276114 "jpeg")) // -- at 4:35 pm Photo mountain = new Photo("Mountain", 2448, 3264, 1276114, "jpeg", this.ct16hr35min); // (define people (make-photo "People" 545 641 13760 "gif")) // - at 7:00 pm Photo people = new Photo("People", 545, 641, 13760, "gif", this.ct19hr00min); // (define plt-icon (make-photo "PLT icon" 16 16 1334 "bmp")) // - at 9:50 am Photo pltIcon = new Photo("PLT icon", 16, 16, 1334, "bmp", this.ct09hr50min); } /* +----------------+ | Photo | +----------------+ | String name | | int width | | int height | | int bytes | | String kind | | ClockTime time |-----------+ +----------------+ | | v +------------+ | ClockTime | +------------+ | int hour | | int minute | +------------+ */