Question
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
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 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 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 public void setName(String name) { this.name = name; } public void setEmail(String email) { this.email = email; } public void borrowBook(Book book) { borrowedBooks.add(book); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started