Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have this code , it can be running but no output produced. So, i attach the question as your reference. Output: Program did not

I have this code , it can be running but no output produced.

So, i attach the question as your reference.

Output:

Program did not output anything!

Please help me solve this.. i need to submit my coding ASAP.

Please run it, and give me the correct coding

this is my fourth time i post this question..still cant produce the desired output.

import java.util.ArrayList; import java.util.HashMap;

public class Library { private HashMap library; private ArrayList patrons;

public Library() { library = new HashMap(); patrons = new ArrayList(); }

public void addBook(int ISBN, String title, String author, String publisher) { Book book = new Book(ISBN, title, author, publisher); library.put(ISBN, book); }

public Book searchBook(int ISBN) { return library.get(ISBN); }

public void displayLast10Books(int patronID) { Patron patron = patrons.get(patronID - 1); ArrayList books = patron.getBorrowedBooks(); int size = books.size(); int start = size - 10; if (start

public void updatePatronInformation(int patronID, String name, String email) { Patron patron = patrons.get(patronID - 1); patron.setName(name); patron.setEmail(email); }

public void initialload() { Book book1 = new Book(1, "The Great Gatsby", "F. Scott Fitzgerald", "Penguin Classics"); Book book2 = new Book(2, "Pride and Prejudice", "Jane Austen", "Penguin Classics"); Book book3 = new Book(3, "To Kill a Mockingbird", "Harper Lee", "Grand Central Publishing"); library.put(book1.getISBN(), book1); library.put(book2.getISBN(), book2); library.put(book3.getISBN(), book3); Patron patron1 = new Patron(1, "John Doe", "john.doe@email.com"); Patron patron2 = new Patron(2, "Jane Doe", "jane.doe@email.com"); patrons.add(patron1); patrons.add(patron2); } public static void main(String[] args) { Library library = new Library(); library.initialload(); library.addBook(4, "JAVA Programming", "James Gosling", "Penguin Classics"); } }

class Book { private int ISBN; private String title; private String author; private String publisher;

public Book(int ISBN, String title, String author, String publisher) { this.ISBN = ISBN; this.title = title; this.author = author; this.publisher = publisher; }

public int getISBN() { return ISBN; }

public String getTitle() { return title; }

public String getAuthor() { return author; }

public String getPublisher() { return publisher; } }

class Patron { private int ID; private String name; private String email; private ArrayList borrowedBooks;

public Patron(int ID, String name, String email) { this.ID = ID; this.name = name; this.email = email; borrowedBooks = new ArrayList(); }

public int getID() { return ID; }

public String getName() { return name; }

public String getEmail() { return email; }

public ArrayList getBorrowedBooks() { return borrowedBooks; }

public void setName(String name) { this.name = name; }

public void setEmail(String email) { this.email = email; }

public void borrowBook(Book book) { borrowedBooks.add(book); } }

image text in transcribed

image text in transcribed

COMMUNITY LIBRARY MANAGEMENT SYSTEM The Kuala Lumpur City Hall (DBKL) has established a community library in Chow Kit. As a software development company, your company has been rewarded with the project of establishing the library management system (LMS) for the community library. The LMS main functionalities for the LMS is to manage the books. Books in the community library are group into two categories of Fiction, Non Fiction. Those categories were then subdivided into genres as shown in Table 1. Each book title belong to one category and one genre. There are possibility of one book title to have more than one copies in the collection. For example, there are two copies of books entitled "One Thousands and One Nights". Therefore those two books must be uniquely identified. If one copy being borrowed, the other should be available to be borrowed by other patrons. Besides book, the LMS should also be able to manage patrons. This include registering patrons, updating their information and most importantly books borrowing and returning functionalities. Each patron may borrow at most of 3 books at any given times Implementing appropriate data structure to store and manage the books and patrons' information, you are required to develop a prototype using JAVA with the following functionalities: 1. Books 1.1 Book display - View all book titles available. 1.2 Add book - Add individual book copy. 1.3 Search book - Search books based on category, genre, title and availability. 1.4 Update books' information. 2. Patrons 2.1. Patron registration - registering a patron into the LMS. 2.2. Search patron - Search for patron based on name, ID, etc. 2.3. View all patrons with active book borrowed. 2.4. Display the last 10 books borrowed by a patron. 2.5. Update patrons' information. Program design documentation a. In this document/report, you need to describe and justify your selection of data structure implemented. You may implement different data structures for each component (i.e. Book and Patron). b. Visualize your chosen data structures for both Book and Patron with sample data. c. Provide the flowchart for the following operations: i. Add book ii. Search book iii. Display the last 10 books borrowed by a patron. iv. Update patrons' information d. Submit your report in PDF format with following naming convention: _CSC508_20224.pdf. (e.g., 2022587469_CSC508_20224.pdf) Complete JAVA program prototype a. The program prototype should be text- and menu-based prototype. Do not use GUI. b. Each functionality, for both Book and Patron should be defined as a method of their own. You may include other methods required for your program to run. c. Please include one helper method initialload( ) that will load 3 sample books and 2 sample patron when the program is executed. d. Submit your prototype as one java file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions

Question

2. Outline the business case for a diverse workforce.

Answered: 1 week ago