Advertisement
savovaap_

3.Library Test Class

May 24th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. import java.util.Date;
  2.  
  3. public class LibraryTestClass {
  4.  
  5.     public static void main(String[] args) {
  6.         Library library = new Library("UKTCLibrary");
  7.  
  8.         library.AddBook(new Book("Book", "UKTCLibrary", new Date(), "987654321", "Josh"));
  9.         library.AddBook(new Book("Book2", "UKTCLibrary", new Date(), "987654321", "Stephen King"));
  10.         library.AddBook(new Book("Book3", "UKTCLibrary", new Date(), "1234569876", "Stephen King"));
  11.  
  12.         for(int i = 0;i < library.Books.size();i++){
  13.             System.out.println(library.BookInfo(library.Books.get(i)));
  14.         }
  15.  
  16.         for(int i = library.Books.size() - 1;i >= 0;i--){
  17.             if(library.Books.get(i).getAuthor().equals("Stephen King")){
  18.                 library.RemoveBook(library.Books.get(i));
  19.             }
  20.         }
  21.  
  22.         System.out.println("Books After Removal ------------");
  23.         for(int i = 0;i < library.Books.size();i++){
  24.             System.out.println(library.BookInfo(library.Books.get(i)));
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement