// to represent a book public class Book implements ISame{ String title; String author; int year; public Book(String title, String author, int year){ this.title = title; this.author = author; this.year = year; } // was this book published before the given year public boolean before(int year){ return this.year < year; } // determine extensional equality of this and given object public boolean same(Object obj){ return this.title.equals(((Book)obj).title) && this.author.equals(((Book)obj).author) && this.year == ((Book)obj).year; } // provide the values of this instance represented as a String public String toString(){ return "\n Book: " + "\n title: " + this.title + "\n author: " + this.author + "\n year: " + this.year + "\n"; } }