/* Tuesday am lecture - Part 2: +---------------+ | Book2 | +---------------+ | String title | | Author author |---------+ | int no | | +---------------+ v +-------------+ | Author | +-------------+ | String name | | int year | +-------------+ */ // to represent a book in a library class Book2{ String title; Author author; int cnum; Book2(String title, Author author, int cnum){ this.title = title; this.author = author; this.cnum = cnum; } } // to represent an author of a book class Author{ String name; int age; Author(String name, int age){ this.name = name; this.age = age; } } // client class for Book and Author classes class Examples{ Examples(){} Author lc = new Author("Lewis Carroll", 1832); Author drs = new Author("Dr Seuss", 1915); Book2 alice = new Book2("Alice", this.lc, 234); Book2 glass = new Book2("TTLG", this.lc, 345); Book2 cathat = new Book2("Cat in a Hat",this.drs, 777); }