// Lecture 2 // CS U213 Fall 2008 // bookstore1.java /* ;; A Book is (make-book String String Num Symbol) ;; There are three kinds of books: fiction, nonfiction, textbook ;; represented by symbols 'F 'N 'T (define-struct book (title author price kind)) ;; Examples of books (define oms (make-book "Old Man and the Sea" "EH" 10 'F)) (define eos (make-book "Elements of Style" "EBW" 20 'N)) (define htdp (make-book "HtDP" "MF" 60 'T)) */ /* +---------------+ | Book | +---------------+ | String title | | String author | | int price | | char kind | +---------------+ */ // to represent a book in a bookstore class Book{ String title; String author; int price; char kind; Book(String title, String author, int price, char kind){ this.title = title; this.author = author; this.price = price; this.kind = kind; } } class Examples{ Examples(){} Book oms = new Book("Old Man and the Sea", "EH", 10, 'F'); Book eos = new Book("Elements of Style", "EBW", 20, 'N'); Book htdp = new Book("HtDP", "MF", 60, 'T'); }