Book store maintains an inventory of books. The store tracks the title and author of each book, plus the book's media. The media is one of hardcover(cloth or leather), paperback, and audio books.
The inventory records whether each hardcover book has either a cloth or a leather cover and how many discs are in each audiobook. Each electronic book has a download URL link that the store wants to use to let a customer browse the book. The store keeps its inventory in a formatted file. Each non-empty line represents a book that the store has in stock.
Each book entry appears as a single line in the file. For example, here are example file entries for different versions and editions of the book "Ulysses" by James Joyce:
Ulysses_James Joyce_895
Ulysses_James Joyce_3195_leather
Ulysses_James Joyce_2395_cloth
Ulysses_James Joyce_0_http://www.amazon.com
Ulysses_James Joyce_1995_3
As you can see, the fields are underscore-separated strings. The fields are the title, author, cost in cents, and an optional field providing details on the book's media format. If there is no media format, the entry is a paperback. Leather and cloth are kinds of hardcover books. The first entry in the example is a paperback, and the last two entries are an electronic book and an 3 disc audiobook respectively.
This short example interaction shows the program printing its inventory list and offering
search options. More detailed sample run is provided in sample_output.txt
$ java Store bookList0.txt
The inventory of Barney's Books 'N' Bytes:
- "Ulysses".
James Joyce.
Paperback. - "Ulysses".
James Joyce.
Hardcover leather. - "Ulysses".
James Joyce.
Hardcover cloth. - "Ulysses".
James Joyce.
Electronic from http://www.amazon.com - "Designing Object-Oriented Software".
Rebecca Wirfs-Brock, Brian Wilkerson, Lauren Wiener
Electronic from http://booksRnotDead.com - "Sometimes a Great Notion".
Ken Kesey.
Audio: 3 discs.
Enter one of these codes (t, a, m)=(title, author, media) and a portion of the desired text. Or enter a blank line to quit. (Note: media format is paper, hard, audio, or electronic). How would you like to search? :