Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.86 KB | None | 0 0
  1. // Names:
  2. // Assignment 2
  3.  
  4.  /** A main program to test the class BookList. */
  5. class TestBookList
  6. {
  7.     /** Test BookList. */
  8.     public static void main(String[] args)
  9.     {  
  10.         BookList books = new BookList();
  11.         // ...
  12.         books.addBook(new Book("David Barnes", "Objects First", 2006));
  13.        
  14.         books.addBook(new Book("Ernest Hemingway", "The Sun Also Rises", 1926));
  15.        
  16.         books.addBook(new Book("JK Rowling", "Harry Potter and the Chamber of Secrets", 1998));
  17.        
  18.         books.addBook(new Book("William Faulkner", "As I Lay Dying", 1930));
  19.        
  20.         books.addBook(new Book("Herman Melville", "Moby Dick", 1851));
  21.        
  22.         books.addBook(new Book("Anthony Burgess", "A Clockwork Orange", 1962));
  23.        
  24.         books.addBook(new Book("Joseph Conrad", "Heart of Darkness", 1902));
  25.        
  26.         books.addBook(new Book("Charles Dickens", "A Christmas Carol", 1843));
  27.        
  28.         books.addBook(new Book("Tucker Max", "I Hope they serve Beer in Hell", 2006));
  29.        
  30.         books.addBook(new Book("Mary Shelley", "Frankenstein", 1818));
  31.  
  32.      
  33.         System.out.println("The full list is:");
  34.         books.printList();
  35.         System.out.println("Books by Tucker Max: ");
  36.         books.printBooksByAuthor("Tucker Max");
  37.         System.out.println("Books by Herman Melville: ");
  38.         books.printBooksByAuthor("Herman Melville");
  39.         System.out.println("Books written in the wrong year: ");
  40.         books.printBooksInYears(1900, 1920);
  41.  
  42.     System.out.println("THIS IS FOR THE EXTRA CREDIT. FULL LIST AS UPPER CASE: ");
  43.     System.out.print(books.toString().toUpperCase());
  44.  
  45.         // Add more tests to fully test your code.  
  46.         // Make sure the correctness of the tests can be seen without reading
  47.         // the source code -- comment on the meanings.
  48.         // ...
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement