Problem: Study how a library operates and develop a software application to model the process for borrower registration, item checkout, and return. In this project, items available for checkout and return includes books and music. All dialog will use the console window.

Basic Functionality

The user of this system is the librarian. Features include listing of items and availability (#copies on hand). Available items can be checked out and returned. Items available for checkout include books and music. For each type of item, multiple copies may be available. The librarian needs to be able to see the history for each borrower. User commands include (1) Display items and quantity on hand, (2) Check-out item, (3) Return item, (4) Display borrower’s history, and (5) Quit.

Test Data and Calculations

To better organize your tests, build a table of the test data and the expected results. This table may be done using a spreadsheet program or word processor. Test your program for each of the following cases. In the last column, indicate Yes or No, as to whether or not your program's output agrees with your expectations. Add one additional test case of your own choosing. See image.

Additional Requirements to Keep in Mind

  • Don’t allow check-out of items that are out of stock or not in the system.
  • Don’t allow return of items that have not been checked-out.
  • Date must be valid.
  • Items can be returned in the overnight drop box, so a user ID is not required for returns.

Initial System Status

Borrowers on File: (ID, name)
001 – D. Manson
002 – Z. Ma
003 – S. Curl
Inventory (Books): (code, name, medium, author, genre, quantity on hand)
HPDH-1,2,3 – Harry Potter and the Deathly Hallows, Book, J.K. Rowling,Wizarding, 784 pages, 3
CSH-1,2 – The Complete Sherlock Holmes, Book, Sir Arthur Conan Doyle, Who Done it, 944 pages, 2
PL-1 – Pirate Latitudes, Book, Michael Crichton, Adventure, 320 pages, 1
Inventory (Music): (code, name, medium, artist, genre, format, quantity on hand)
HWGA-1,2,3, Here We Go Again, Music, Wynton Marsalis, blues, audio CD, 3
MC-1,2, McCartney, Music, Paul McCartney, rock, MP3 download, 2

Besides the above, include three more music selections of your own choosing.

Classes and Responsibilities

This project requires the following classes and methods for successful implementation. . These structures can be supplemented as necessary. Arguments and return values are a minimum but may be extended. You are to create any remaining classes, variables, and methods as appropriate for your program design.

  • Class name: LibraryApp Responsibility: Contains main method for the application
  • Class name: LibraryUI Responsibility: Handles all dialog with the user, communicates with controller
  • Class name: LibraryController Responsibility: Represents the system model to the user interface
  • Class name: Borrower Responsibility: Borrows and returns items
  • Class name: Record Responsibility: Track checkout and return history
  • Class name: Item {Abstract} Responsibility: Item information including ID, title, and number of copies available
  • Class name: Book {Parent: Item} Responsibility: Book information including author, genre, and number of pages
  • Class name: Music {Parent: Item} Responsibility: Music information including artist, genre, and format (e.g., audio CD, MP3 download)
  • Class name: LibraryCollection Responsibility: Holds instances of items held by the library for check-out and return

Note: Assume this is a new system and no items have been checked out when the program starts. I- Test cases should be consistent with the output from the menu options for (1) display items & quantity on hand and (2) display borrower’s history.

Extra Credit #1 – Welcome Dialog

When the application starts, use a JOptionPane showMessageDialog to display a welcome message form. Your form should include the title Library System, an exclamation icon (!), the message Welcome to the Library! (or something similar), the message Click OK to begin, and an OK button. Clicking OK will close the form and continue the application (see example below). See image.

Extra Credit #2 – Confirm Exit Dialog

With extra credit #1 complete, have the program confirm exiting the application. Use a JoptionPane showOptionsDialog with buttons for Yes and No. If Yes, close the application; if No, continue as if nothing happened. The title is Library System; use a question mark for the icon, plus an appropriate message. The default button should be set to No (see example below). See image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.