Kimes

Untitled

Mar 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. public void addBook(String title, String year, String author) {
  2.         uniqueID++;
  3.         if (bookMap.isEmpty() == false) {
  4.             for (Book book : bookMap.values()) {
  5.                 if (book.getTitle().equals(title) && (book.getYear().equals(year))
  6.                         && (book.getAuthor().equals(author))) {
  7.                     int addCopy = book.addCopy();
  8.                     addCopy++;
  9.                 }
  10.             }
  11.         } else {
  12.             Book newBook = new Book(title, year, author, uniqueID, numberOfCopies);
  13.             bookMap.put(uniqueID, newBook);
  14.         }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment