Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Names:
- // Assignment 2
- /** A main program to test the class BookList. */
- class TestBookList
- {
- /** Test BookList. */
- public static void main(String[] args)
- {
- BookList books = new BookList();
- // ...
- books.addBook(new Book("David Barnes", "Objects First", 2006));
- books.addBook(new Book("Ernest Hemingway", "The Sun Also Rises", 1926));
- books.addBook(new Book("JK Rowling", "Harry Potter and the Chamber of Secrets", 1998));
- books.addBook(new Book("William Faulkner", "As I Lay Dying", 1930));
- books.addBook(new Book("Herman Melville", "Moby Dick", 1851));
- books.addBook(new Book("Anthony Burgess", "A Clockwork Orange", 1962));
- books.addBook(new Book("Joseph Conrad", "Heart of Darkness", 1902));
- books.addBook(new Book("Charles Dickens", "A Christmas Carol", 1843));
- books.addBook(new Book("Tucker Max", "I Hope they serve Beer in Hell", 2006));
- books.addBook(new Book("Mary Shelley", "Frankenstein", 1818));
- System.out.println("The full list is:");
- books.printList();
- System.out.println("Books by Tucker Max: ");
- books.printBooksByAuthor("Tucker Max");
- System.out.println("Books by Herman Melville: ");
- books.printBooksByAuthor("Herman Melville");
- System.out.println("Books written in the wrong year: ");
- books.printBooksInYears(1900, 1920);
- System.out.println("THIS IS FOR THE EXTRA CREDIT. FULL LIST AS UPPER CASE: ");
- System.out.print(books.toString().toUpperCase());
- // Add more tests to fully test your code.
- // Make sure the correctness of the tests can be seen without reading
- // the source code -- comment on the meanings.
- // ...
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement