;; 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-2b) (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-2b.java ;; A Picture is (make-photo 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 | +-------------+ */ class Photo{ String name; int width; int height; int bytes; String kind; Photo(String name, int width, int height, int bytes, String kind){ this.name = name; this.width = width; this.height = height; this.bytes = bytes; this.kind = kind; } } class Examples{ Examples (){} // (define river (make-photo "River" 3456 2304 3614571 "jpeg")) Photo river = new Photo("River", 3456, 2304, 3614571, "jpeg"); // (define mountain (make-photo "Mountain" 2448 3264 1276114 "jpeg")) Photo mountain = new Photo("Mountain", 2448, 3264, 1276114, "jpeg"); // (define people (make-photo "People" 545 641 13760 "gif")) Photo people = new Photo("People", 545, 641, 13760, "gif"); // (define plt-icon (make-photo "PLT icon" 16 16 1334 "bmp")) Photo pltIcon = new Photo("PLT icon", 16, 16, 1334, "bmp"); }