ArrayList<Book> to hold our books.
addBook that assigns a reference number to a book and adds a Book to the library.
displayAll to print info about all books in the library
In this lab, we will add methods to the Library to continue practicing with loops and ArrayLists.
Book findBook(String author, String title) to find a book based on author and title. If no book exists with that author and title, return null. Otherwise, return the book.
Remember that strings are compared using the .equals
method (e.g. if (foo.equals(currentBook.getAuthor()))
boolean anyBooks(String author) to
the Library class that returns true if the library holds any books
by the given author, or false if not.
ArrayList<Book> findAuthor(String author) to the
library that searches the library to find books by the given
author. The method returns either a reference to an ArrayList
holding the references to these books or null if no books are found
by the author.
removeNote from the
notebook projct of chapter 4 (and seen on page 88 of the
text), add a void removeBook(int i) method to the
Library that is given the index of a book and removes it from the
library.
void removeBook(String author, String
title) that removes the specified book from the library (or
does nothing if it is not in the library).