Advertisement
Kimes

Untitled

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