Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

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 After May 21, 2021

Solution

Shweta answered on May 24 2021
150 Votes
84824/Li
aryInventorySystem
uild/classes/.netbeans_automatic_build
84824/Li
aryInventorySystem
uild/classes/.netbeans_update_resources
84824/Li
aryInventorySystem
uild/classes/li
aryinventorysystem/Book.class
package li
aryinventorysystem;
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/Li
aryInventorySystem
uild/classes/li
aryinventorysystem/Li
aryInventorySystem.class
package li
aryinventorysystem;
public synchronized class Li
aryInventorySystem {
public void Li
aryInventorySystem();
public static void main(String[]);
}
84824/Li
aryInventorySystem
uild/classes/li
aryinventorysystem/MainMenu$1.class
package li
aryinventorysystem;
synchronized class MainMenu$1 implements java.awt.event.ActionListener {
void MainMenu$1(MainMenu);
public void actionPerformed(java.awt.event.ActionEvent);
}
84824/Li
aryInventorySystem
uild/classes/li
aryinventorysystem/MainMenu$2.class
package li
aryinventorysystem;
synchronized class MainMenu$2 implements java.awt.event.ActionListener {
void MainMenu$2(MainMenu);
public void actionPerformed(java.awt.event.ActionEvent);
}
84824/Li
aryInventorySystem
uild/classes/li
aryinventorysystem/MainMenu$3.class
package li
aryinventorysystem;
synchronized class MainMenu$3 implements java.awt.event.ActionListener {
void MainMenu$3(MainMenu);
public void actionPerformed(java.awt.event.ActionEvent);
}
84824/Li
aryInventorySystem
uild/classes/li
aryinventorysystem/MainMenu$4.class
package li
aryinventorysystem;
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/Li
aryInventorySystem
uild/classes/li
aryinventorysystem/MainMenu.class
package li
aryinventorysystem;
public synchronized class MainMenu {
java.util.A
ayList listbooks;
public void MainMenu();
public void addBooks();
}
84824/Li
aryInventorySystem
uild.xml

Builds, tests, and runs the project Li
aryInventorySystem.


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















































































































































































































Must set src.di
Must set test.src.di
Must set build.di
Must set dist.di
Must set build.classes.di
Must set dist.javadoc.di
Must set build.test.classes.di
Must set build.test.results.di
Must set build.classes.excludes
Must set dist.ja




































































































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