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;
private LibraryService libraryService;
// Getters and Setters public int getId() return id; public String getTitle() return title; public String getAuthor() return author; public String getGenre() return genre; public int getQuantity() return quantity; public void setQuantity(int quantity) this.quantity = quantity; Library Management System Project In Java With Source Code
public void issueBook(int bookId, int memberId) Book book = libraryService.findBookById(bookId); Member member = libraryService.findMemberById(memberId);
public void showAllBooks() if (books.isEmpty()) System.out.println("No books in the library."); return; System.out.println("\nID public Book(int id, String title, String author, String
public TransactionService(LibraryService libraryService) this.libraryService = libraryService;
public void returnBook(int bookId) if (!issuedBooks.containsKey(bookId)) System.out.println("This book was not issued."); return; public Book(int id
@Override public String toString() return memberId + " package service; import model.Book; import model.Member; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors;
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;
private LibraryService libraryService;
// Getters and Setters public int getId() return id; public String getTitle() return title; public String getAuthor() return author; public String getGenre() return genre; public int getQuantity() return quantity; public void setQuantity(int quantity) this.quantity = quantity;
public void issueBook(int bookId, int memberId) Book book = libraryService.findBookById(bookId); Member member = libraryService.findMemberById(memberId);
public void showAllBooks() if (books.isEmpty()) System.out.println("No books in the library."); return; System.out.println("\nID
public TransactionService(LibraryService libraryService) this.libraryService = libraryService;
public void returnBook(int bookId) if (!issuedBooks.containsKey(bookId)) System.out.println("This book was not issued."); return;
@Override public String toString() return memberId + " package service; import model.Book; import model.Member; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors;