Question: IN JAVA design and create an application that manages a small library with a collection of books using ArrayList. Information about a book includes ISBN,

IN JAVA design and create an application that manages a small library with a collection of books using ArrayList. Information about a book includes ISBN, title, author, publisher, and publishing year. The catalog of books and the information of each book are stored in a text file before and after the program is executed. You will need to write the code for one interface (BookCatalogInterface) and three classes (Book, BookCatalog, and LibraryApplication), for which the details are given below. Interface BookCatalogInterface - The interface file for the BookCatalog. This interface should include the following methods: o loadData this method should have a file name as the parameter. The method loads the data containing all the books from a given file. o displayCatalog this method displays all the books in the catalog. o searchForBook this method should have a title as the parameter. It should return the Book object if found, or null if not found. o addBook this method is used to add a new Book. It should have five parameters that represent the ISBN, title, author, publisher, and publishing year. If the title is already in the book catalog, then a message should be printed informing the user that the book already exists. This method returns a boolean value. If the book is added, it returns true; otherwise it returns false. o updateBook this method is used to update the information of an existing book. It should have five parameters that represent the ISBN, title, author, publisher, and publishing year. If the title is not currently in the book catalog, then a message should be printed informing the user that the book does exist. Otherwise update the book information in the catalog. This method returns a boolean value. If the book is updated, it returns true; otherwise it returns false. o removeBook this method should have a title as the parameter. It should remove the Book from the catalog if the title is found. Otherwise it should print a message. This method returns a boolean value. If the book is removed, it returns true; otherwise it returns false. o getBooksByPublisher this method should have a publisher as the parameter. It should return an ArrayList object with all the books by the given publisher. If there is no book by the given publisher, the size of the ArrayList will be zero. o sortByTitle this method sorts all the books based on title. o Save this method has no parameter. It should write the book catalog back to the file if the data has been changed (the same file is used for both reading and writing).

Please include detailed Javadoc comments for all the methods in the interface as well asin the class that implements the interface.

Classes LibraryApplication - The class for the main program. You will need to read the data from input file, display menu options, and perform various tasks that user selects. BookCatalog - The class for the book catalog. The book catalog must be stored in an ArrayList object. You will need to write the code for all the methods specified in the BookCatalogInterface. You may add additional methods as needed to this class, however ALL additional methods you add MUST be declared as private. Book - The class containing all of the information and methods for one book. o The information to be stored is: ISBN, title, author, publisher, and publishing year. You should include one constructor with five parameters with given information for a book. o You should include get methods for ALL five of the data fields. o You should include set methods for all of the data fields EXCEPT title. The title of any book is not allowed to be changed. o You will need to write the code for the toString method. o You will need to write the code for the equals method. This method should have one parameter of Object type. Two book objects are considered to be equal if they have the same title. o You will need to write the code for the compareTo method. This method should have one parameter of Book type. The order of the books is based on the alphabetical order of the title. Note that in order to have this method, your Book class should implement the Comparable interface.

Program Requirements As your program begins, it should read previously saved data from a file. The name of the file will be assg6_catalog.txt. Do not change the file name! The data in the file should be in the following format; i.e. each piece of data should be on a separate line , ISBN on the first line, followed by title, author, publisher, and year, on separate lines. The input file contains information for multiple books in this format. There is a blank line between two books next to each other. The program should then display a menu of options to the user and allow the user to make choices from the menu. This continues until the user selects the exit option from the menu. Upon exiting, the program should save the book catalog back to the file if any change (including adding, removing, updating, and sorting) has been made.

Menu Options The program should have a menu with the following options: Display all the books in the catalog Search for a book Add a new book Update an existing book Remove a book Display books by a publisher Sort all the books based on title Save data Exit Each time after the results are displayed for a given selection, ask user to press Enter to continue. For the menu Display all the books in the catalog, the program will display the detailed information of all the books in the catalog. For the menu Search for a book, the program will ask user to enter the title of a book. If found, it will display the complete information of the book. Otherwise, it will print a message if the book is not found. For the menu Update an existing book, after a user enters the title of a book, there should be a submenu that allows the user to choose which information (ISBN, author, publisher, and year) the user would like to change for the book and an option to return to the main menu. The user should be allowed to choose from this submenu, making changes to any of the book's data fields (except for title) until option 0 is selected, which will return back to the main menu.

For the menu Remove a book, the program will ask user to enter a title. If the book is found, it will be removed from the catalog. Otherwise, it will print a message if the book is not found. For the menu Display books by a publisher, the program will display the titles of all the books (if any) by the given publisher. If there are no such books, display a message. For the menu Sort all the books based on title, you can call Collections.sort method to sort all the bookslhe books in the list. Make sure you implement compareTo method correctly.

For the Save data menu, if any change has been made to the catalog, the program will save the updated catalog to the file. For the Exit menu, upon exiting, the program should check if any changes have been made. If so, the modified data should be saved and written back to the file.

Sample Input File: 1400030032 My Life Bill Clinton Vintage 2005 0822212099 A View From the Bridge Arthur Miller Dramatists Play 1998

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!