Advice: Start by implementing the LibraryItem, Book, and MultimediaItem classes, with a test class. Then add in the LibraryCollection class later. In each case, the test files must be in separate classes.
Testing: Enter and save at least 3 Book objects and 3 MusicCD objects to test your application. Use different items than the ones in this Project Description. You can get Dewey Decimal Numbers for the items that you enter from any library website. You can use the Library of Congress number system if you prefer.
Details:
1.Before starting to write any source code, draw the UML diagram using Violet or some other drawing system.
2.Implement these classes: LibraryItem, Book, MusicCD, LibraryCollection
LibraryItem Fields: _id _title _year _id
Book Base class: LibraryItem Fields: _author _publisher
MusicCD Base class: LibraryItem Fields: _performer _composer _label
For the LibraryItem, Book, and MusicCD objects include these methods:
Methods: noarg constructor, parameterized constructor, getters, toString method.
LibraryCollection Field: _col (ArrayList collection)
Methods: noarg constructor, addBook (add book), displayAll (display all books), find (find all objects with specified substring in title), getItem (get and print item with specified id), load (deserialize _col from .ser file), addMusicCD (add music CD), removeItem (remove item), save (serialize col to .ser file).
3.Implement a main method in the Shell class that repeatedly inputs commands to execute LibraryCollection methods. Here are example outputs:
Enter a command for the Library
Collection Management System.
Add (B)ook, (D)isplay All, (F)ind, (G) Get Item,
(L)oad, Add (M)usic CD, (R)emove, (S)ave: B
Enter Book information:
Dewey Decimal Number: 822.91W725
Title: Lord of the Flies
Author: William Golding
Publisher: Faber and Faber
Date: 1954
The following item has been added:
Item Type: Book
Dewey Decimal Number: 822.91W725
Title: Lord of the Flies
Author: William Golding
Publisher: Faber and Faber
Year: 1954
Enter a command for the Library
Collection Management System.
Add (B)ook, (D)isplay All, (F)ind, (G) Get Item,
(L)oad, Add (M)usic CD, (R)emove, (S)ave: B
Enter Book information:
Dewey Decimal Number: 823.91T649
Title: Lord of the Rings
Author: J.R.R. Tolkein
Publisher: Mass Market Paperback
Date: 1949
The following item has been added:
Item Type: Book
Dewey Decimal Number: 823.91T649
Title: Lord of the Rings
Author: J.R.R. Tolkein
Publisher: Mass Market Paperback
Year: 1949
Enter a command for the Library
Collection Management System.
Add (B)ook, (D)isplay All, (F)ind, (G) Get Item,
(L)oad, Add (M)usic CD, (R)emove, (S)ave: M
Enter Music CD information:
Dewey Decimal Number: 793.31DVDLOR
Title: Lord of the Dance
Performer: Michael Flatley
Composer: Ronan Hardiman
Label: Polygram
Date: 1997
The following item has been added:
Item Type: Music CD
Dewey Decimal Number: 793.31DVDLOR
Title: Lord of the Dance
Performer: Michael Flatley
Composer: Ronal Hardiman
Label: Polygram
Year: 1949
Enter a command for the Library
Collection Management System.
Add (B)ook, (D)isplay All, (F)ind, (G) Get Item,
(L)oad, Add (M)usic CD, (R)emove, (S)ave: G
Dewey Decimal Number of item to get: 822.91W725
Item type: Book
ID: 822.91W725
Title: Lord of the Flies
Author: William Golding
Publisher: Faber and Faber
Year: 1954
Enter a command for the Library
Collection Management System.
Add (B)ook, (D)isplay All, (F)ind, (G) Get Item,
(L)oad, Add (M)usic CD, (R)emove, (S)ave: F
Enter string for title search: Lord
Objects whose title contains the substring "Lord":
Item type: Music CD
ID: 793.31DVDLOR
Title: Lord of the Dance
Performer: Michael Flatley
Composer: Ronan Hardiman
Label: Polygram
Year: 1997
Item type: Book
ID: B15
Title: Lord of the Flies
Author: Golding, William
Publisher: Faber and Faber
Year: 1954
Item type: Book
ID: B27
Object type: Book
Title: Lord of the Rings
Author: J.R.R. Tolkien
Publisher: Mass Market Paperback
Year: 1949
Enter a command for the Library
Collection Management System.
Add (B)ook, (D)isplay All, (F)ind, (G) Get Item,
(L)oad, Add (M)usic CD, (R)emove, (S)ave: L
Library items loaded.
Enter a command for the Library
Collection Management System.
Add (B)ook, (D)isplay All, (F)ind, (G) Get Item,
(L)oad, Add (M)usic CD, (R)emove, (S)ave: R
ID to remove: 793.31DVDLOR
Object with Dewey Decimal Number 793.31DVDLOR removed.
Enter a command for the Library
Collection Management System.
Add (B)ook, (D)isplay All, (F)ind, (G) Get Item,
(L)oad, Add (M)usic CD, (R)emove, (S)ave: S
Library items saved.
4.The toString methods of the Book and MusicCD classes should return the output that is shown for LibraryCollection display, get, and find methods.
5.Keeps a log of all Display, Get, and Find requests that the library staff can analyze later to get ideas for new books to purchase.
6.The LibraryCollection class should implement the Comparable interface so that the results of the Inventory find method can be sorted before being returned.
7.The LibraryCollection class should implement the Serializable interface so that its collection (ArrayList or HashMap) can be serialized to or deserialized from a .ser file.
8.Optional: instead of using an ArrayList, consider using a HashMap collection to hold the LibraryItem objects. This would make the LibraryCollection methods display more quickly if the library has many items to check out.
9.Include Javadoc comments in each of your classes. When your project is finished, run the javadoc utility and include the generated doc folder of html files in your project zipfile. Use Javadoc comments at the beginning of classes, constructors, and methods.
Format of Javadoc comment before a class:
/**
* Short description of class
*
* @author Stan Smith
* @version 1.6 2/26/14
*/
public class MyClass {
// class body
}
Format of a Javadoc comment before a constructor or method:
/**
* Short one line description.
* < p>
* Longer description. If there were any,
* it would be here.
* < p>
* And even more explanations to follow in
* consecutive paragraphs separated by HTML
* paragraph breaks.
* < p>
* @param parameter description.
* @return return value description
* @throws description of exceptions thrown
*/
public int methodName(...) {
// method body }
Format of a Javadoc comment before a public field:
/**
* Description of variable here.
*/
public final int constantName = 1234;