December 2, 2018 / Book Manager with an ArrayList / Due: ______
Purpose
The purpose of this project is to expand the previous Book Manager project to provide additional functionality. In that previous assignment, you created a Book class which managed information concerning a single Book. The driverinput information to create a Book and displayed that information in a nicely formatted way.
In this assignment, you will add a PersonalLibrary class that will manage a collection of Book objects. You will also modify and expand the driver to make use of the PersonalLibrary.
Put all of the classes that you have written or will write for this project in a Javapackage named books. Leave other code in whatever package it already is (such as util).
PersonalLibrary Class
The PersonalLibrary will manage a collection of Book objects. If yourBook class met all of the specifications for the first project, it need not change for this project. In addition to the usual features (constructors, getters/setters, toString, etc.), the PersonalLibrary class needs to have the following features.
- The size of your Book collection should not be limited, so use an ArrayList to hold the collection of Book objects. It should be a privateattribute.
- A user of the PersonalLibrary needs to be able to
- Add a Book to the PersonalLibrary – but only if it is not already there
- Remove a Book from the PersonalLibrary – but only if it is present in the PersonalLibrary
- Retrieve a Book from the PersonalLibrary
- Using the Index (position) of the Book in the PersonalLibrary
- Using the Book’stitle
- Retrieve all Book objects, one of whose authors has a specified name
- Retrieve all Book object with a specified BookType
- Determine whether a Book is in the PersonalLibrary
- Sort the Books in the PersonalLibrary into ascending order of their titles
- Determine how many Book objects are currently in the PersonalLibrary
- Determine the current monetary value of the PersonalLibrary by finding the total of all of the Book prices
- Format the collection of Books as a String for possible display by the driver
- Appropriate methods must be added to PersonalLibrary to accomplish each of these tasks. They should have meaningful names such as addBook, removeBook, getBook, and so forth.
The Driver Class
Expand and modify the driver to allow a user to make use of the PersonalLibrary class. The interaction with the user should be “user-friendly.” Correct spelling and grammar are important.
The driver should have at least the following features, but it may have other enhancements as well.
- The driver should have a PersonalLibrary object as a private attribute
- It should do all I/O for the program including displays of error messages
- It should have an expanded menu that allows to the user of the program to do such things as
- Create and add a book to the library
- Remove a book from the library
- Retrieve and display a specific book by specifying its title or subscript (index)
- Determine how many books are in the library
- Determine the total value of all books and the average price of the books in the library
- Display all the books in the library in an appropriately formatted way
- Sort the books in the library by their titles
- Terminate the application
- The driver should display appropriate welcome and goodbyemessages at the appropriate time
- The driver should make good use of existing classes such as ArrayList, Book, BookType, Category, Menu, and so forth by using rather than reinventing the features they already have
Be sure to test the entire program with 7 or more Book objects. Try to provide test data that will “break” the program as well as valid test data.
Submission
Turn in your initial design document according to the specifications and schedule posted on the course web site. Only include the classes that you will or have created in your design (i.e., you do not need to include the String class, the Scanner class, or the ArrayList class in your class diagram).
Submit your final design along with ALL .java files from your project in the subfolders that represent their packages. For example, you may have two packages named books and util (if you use my Menu class). Your zipped file should include these two folders along with the .java files they contain. The zipped folder then contains: your final design document, your books folder (with its .java files), and the util folder (with its .java files).
Name the zipped file according to the Course Facts document and submit it according the schedule posted on the website.
Project 3 – PersonalLibraryPage 1