You are writing an inventory system for a library. First, you will create a "Book" class with fields containing information on the publish year (an integer), number of pages (an integer), title, and...

1 answer below »

You are writing an inventory system for a library.


First, you will create a "Book" class with fields containing information on the publish year (an integer), number of pages (an integer), title, and author. There should be getter and setter methods for both. The year setter should make sure the user doesn't pass a negative value or a value greater than 2021. The number of pages setter should make sure the user doesn't pass a negative value. Also override toString to print all info about a book and make sure the Constructor allows the user to set all data about a book and performs the same input validation.



  • In your Main.java's main method, in a continuous loop, give the user to the option to add a book, view books, and quit. The books will be added to an ArrayList of Book objects.

    • If the user chooses to add a book, call a method named addBook which asks the user to enter a title, publish date, and number of pages. Create a Book and then add it to the ArrayList.


    • If the user chooses to view books, call a function named viewBooks which prints all information (using toString) about the books in the ArrayList.



Answered 2 days AfterMay 21, 2021

Answer To: You are writing an inventory system for a library. First, you will create a "Book" class with fields...

Shweta answered on May 24 2021
149 Votes
84824/LibraryInventorySystem/build/classes/.netbeans_automatic_build
84824/LibraryInventorySystem/build/classes/.netbeans_update_resources
84824/LibraryInventorySystem/build/classes/libraryinventorysystem/Book.class
package libraryinventorysystem;
public synchronized class Book {
Integer publishYear;
Integer noOfPages;
String title;
String author;
public void Book(Integer, Integer, String, String);
public int getPublishYear();
public int getNoOfPages();
public String getTitle();
public String getAuthor();
public void setPublishYear(int);
public void setNoOfPages(int);
public void setTitle(String);
public void setAuthor(String);
public String toString();
}
84824/LibraryInventorySystem/build/classes/libraryinventorysystem/LibraryInventorySystem.class
package libraryinventorysystem;
public synchronized class LibraryInventorySystem {
public void LibraryInventorySystem();
public static void main(String[]);
}
84824/LibraryInventorySystem/build/classes/libraryinventorysystem/MainMenu$1.class

package libraryinventorysystem;
synchronized class MainMenu$1 implements java.awt.event.ActionListener {
void MainMenu$1(MainMenu);
public void actionPerformed(java.awt.event.ActionEvent);
}
84824/LibraryInventorySystem/build/classes/libraryinventorysystem/MainMenu$2.class
package libraryinventorysystem;
synchronized class MainMenu$2 implements java.awt.event.ActionListener {
void MainMenu$2(MainMenu);
public void actionPerformed(java.awt.event.ActionEvent);
}
84824/LibraryInventorySystem/build/classes/libraryinventorysystem/MainMenu$3.class
package libraryinventorysystem;
synchronized class MainMenu$3 implements java.awt.event.ActionListener {
void MainMenu$3(MainMenu);
public void actionPerformed(java.awt.event.ActionEvent);
}
84824/LibraryInventorySystem/build/classes/libraryinventorysystem/MainMenu$4.class
package libraryinventorysystem;
synchronized class MainMenu$4 implements java.awt.event.ActionListener {
void MainMenu$4(MainMenu, javax.swing.JTextField, javax.swing.JTextField, javax.swing.JTextField, javax.swing.JTextField, javax.swing.JFrame);
public void actionPerformed(java.awt.event.ActionEvent);
}
84824/LibraryInventorySystem/build/classes/libraryinventorysystem/MainMenu.class
package libraryinventorysystem;
public synchronized class MainMenu {
java.util.ArrayList listbooks;
public void MainMenu();
public void addBooks();
}
84824/LibraryInventorySystem/build.xml

Builds, tests, and runs the project LibraryInventorySystem.


84824/LibraryInventorySystem/manifest.mf
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
84824/LibraryInventorySystem/nbproject/build-impl.xml















































































































































































































Must set src.dir
Must set test.src.dir
Must set build.dir
Must set dist.dir
Must set build.classes.dir
Must set dist.javadoc.dir
Must set build.test.classes.dir
Must set build.test.results.dir
Must set build.classes.excludes
Must set dist.jar




































































































Must set javac.includes
































































































































No tests executed.



























































...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here