/* +--------------+ | Book | +--------------+ | String title | | String author| | int year | +--------------+ */ //to represent a book class Book implements ISame{ String title; String author; int year; Book(String title, String author, int year){ this.title=title; this.author=author; this.year=year; } //is this book the same as that object public boolean same(ISame that){ if (that instanceof Book) return this.title.equals(((Book)that).title) && this.author.equals(((Book)that).author) && this.year==((Book)that).year; else return false; } }