public class Book implements Comparable {
    String title;
    int    isbn;

    Book(String title, int isbn) {
        this.title = title;
        this.isbn  = isbn;
    }

    public String toString() {
        return title + " " + String.valueOf(isbn);
    }

    public boolean equals(Object object) {
        if (object instanceof Book) {
            Book other = (Book) object;

            return this.title.equals(other.title) && (this.isbn == other.isbn);
        } else {
            return false;
        }
    }

    public int compareTo(Object object) {
        Book other = (Book) object;

        if (this.title.equals(other.title)) {
            return this.isbn - other.isbn;
        }

        return this.title.compareTo(other.title);
    }
}


