Question: PHASE 1 You will implement a virtual bookstore in this time and next time homework assignments. Your task is to write a Java program to

PHASE 1 You will implement a virtual bookstore in this time and next time homework assignments. Your task is to write a Java program to keep track of books in a bookstore. The program should have a command line menu-driven interface that allows a user to insert, view, modify or remove a book item. A virtual bookstore keeps a book list which contains all the books in the store. Whenever a book is added to the store, it will get a unique id , ISBN , price, quantity and other book information will be registered. The quantity of a given book decreases when some copies are sold and increases if more copies are added. A book item consists of: title, author, ISBN, price and quantity. For this phase, you have to complete the following tasks: 1. Implement the Book class represented in the following UML diagram. Book -id: int -title: String -author: String -isbn: String -price: float -quantity: int +Book() +Book(String,String,String,float,int) +setTitle(String) +setAuthor(String) +setISBN(String) +setPrice(float) +setQuanitity(int) +getBookID(): int +getTitle(): String +getAuthor(): String +getISBN(): String +getPrice(): float +getQuantity(): int 2. Use the following piece of code which allows you to display a command-line menu to the user. Write the required java methods\statements to make use of the code. For each of the options you have to implement the correspondent task through a method, i.e., addBook(Book book) which creats a new book object, displayBookInfo(Book book) which displays the info of a given book object, etc. The program should run until the user chooses option 4, Quit. do { //display menu to user and ask user for her choice System.out.println(); System.out.println("1) Add a book"); System.out.println("2) Display all information about a book"); System.out.println("3) Change the available quantity of a book "); System.out.println("4) Quit"); System.out.println(); System.out.print("Enter choice [1-4]: "); user_choice = inputScanner.nextInt(); switch (user_choice) { //write the required code to identify users choice and accomplish the required task } } while (!quit); PHASE 2In this phase you will continue the work in the virtual book store program.The book store keeps a book list. The book list should be implemented using an array in Java. You will add a new data field, totalNumOfBooks, which represents the total number of books in the bookstore. totalNumOfBooks is incremented every time a book is added.You have to implement the following tasks:1. Create an array named booklist of length 10. Booklist contains objects of the class Book.2. Add the totalNumOfBooks data field to the class Book3. Change the signature of the methods responsible for realizing the menu options so that the book list is passed to the methods. I.e., addBook(Book book) will be addBook(Book[] bookList) and so on.4. The addBook(Book[] bookList) method checks if the booklist is full before adding a new book to it. In case the booklist array is full, ita. copies the contents of the array to a new temp arrayb. creates a new array with double the current lengthc. copies back temp to the new booklist array5. You will add a new option to the menu Display all books, which uses System.out.printf() to display the information of all the books in the book store in a table format.6. Display error messages to the user in case of entering wrong input.Useful tips:1. Read all of the required input as string objects using nextLine(); avoid using nextInt(),nextFloat().2. Remember! The id data field is updated automatically (is not set by the user). It represents the serial number of the book in the store. E.g., the id of the first book added is 1, second book is 2, third book is 3, etc. I need this put with an arraylist.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!