Mit deinem Mindfactory Konto anmelden
AnmeldenWillkommen bei Mindfactory.de
Jetzt registrieren oder als Gast bestellen
public TransactionService(LibraryService libraryService) this.libraryService = libraryService;
public class TransactionService private Map<Integer, Integer> issuedBooks = new HashMap<>(); // bookId -> memberId
public Book findBookById(int id) return books.stream().filter(b -> b.getId() == id).findFirst().orElse(null);
public Book(int id, String title, String author, String genre, int quantity) this.id = id; this.title = title; this.author = author; this.genre = genre; this.quantity = quantity;
public void returnBook(int bookId) if (!issuedBooks.containsKey(bookId)) System.out.println("This book was not issued."); return;
// Getters public int getMemberId() return memberId; public String getName() return name; public String getEmail() return email; public String getPhone() return phone;
int choice = scanner.nextInt(); scanner.nextLine(); // consume newline