Question
Use stacks to implement the book check-in process at a library. You are working at a local library and one of your job responsibilities is
Use stacks to implement the book check-in process at a library.
You are working at a local library and one of your job responsibilities is to stack the returned books to appropriate shelves. All books in the library are assigned a call number in a specific format two letters for the genre followed by a three-digit number. The library uses the following genres CL (classic), FI (fiction), NF (non-fiction), YA (young adult), and independent genre for the all the other books.
You have to write a Java program that uses a stack and helps you or the user of the program with the check-in process of the books. The program should prompt the user for the call numbers of the returned books. The user enters X when there are no more call numbers to be entered. The call numbers are added to a stack (use LinkedStack). The program will then read each of the call numbers from the stack and let the user know the shelf on which each book should go, based on the genre of that book. For example, if the call number is FI234, the program will display Call No. FI234 belongs to FICTION shelf. Similarly, if the call number is HI786, the program will display Call No. HI786 belongs to INDEPENDENT shelf.
After providing the shelving instructions for each book in the stack. The program will display the book check-in report with total number of books checked in and also the number of books checked in for each genre. Write a size() method in the LinkedStack class to find the total number of books in the stack (any other solution, such as summing up the count of books in each genre, will not be accepted). Sample report could look like this
Note:
1. You are given assign3LS folder with some java files in it. Copy the assign3LS package to your eclipse workspace. Write the driver program in the same package.
2. You may use any of the methods from the StackInterface. Any helper method(s), if needed, may be implemented in the LinkedStack class.
3. You may assume that the user will enter the correct call numbers. If the call number doesnt start with CL, FI, NF, or YA, then you can consider that the book belongs to independent genre.
4. If the user doesnt enter any call number, the stack will be empty. Instead of displaying the report, you could display a message - No books returned today. Good-bye!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started