Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help with java program, please explain it. I'm having a hard time doing it You're working on a data storage system for a library
Need help with java program, please explain it. I'm having a hard time doing it
You're working on a data storage system for a library to keep track of the books on its shelves. The library has a fixed amount of shelf space to work with (for convenience here, we're going to assume all books take up the same amount of shelf space), so they don't expect their collection to expand, though old books may be swapped out for new ones from time to time. The biggest concern is finding books in the system and flagging them as either in the library or out on loan. Every day, the library's system must handle many transactions of looking up a book and flagging it as either in or out. Since people have to wait at the counter for the system to finish processing and the old computers available to the library aren't the fastest, time efficiency during these operations is a priority. You've been assigned to work on the data structure and functions that will support this library system. Each book is stored with a name (there can be duplicates), an author's name, a boolean that flags the book as either out or in, and a unique ID integer. These ID integers are tied to spaces on the library's shelves and start at 0, so they can also be used to retrieve and return a book when someone checking it out at the counter requests it. The available functions should include checking out, returning, checking the status of, and getting the name and title of a book based on its ID. It should also be possible to remove an old book from a given shelf spot, put a new book into an empty spot, or swap an old book for a new book, all also based on the ID. Finally, it should be possible to check how many books the library owns, currently has in, and currently has lent out. A reasonable amount of error-handling should be expected throughout, though no specific instructions are given here. You must submit one Java file that provides this functionality, though it may include more than one class. The test class must demonstrate all of the desired functions, though you're free to define and load as many test books into your library system as you believe the tests need. Your written answer for this question must explain why your choice of data structure matches the needs of this scenario. You should include an asymptotic run-time analysis for each of your functions, and explain how these match the needs of the library. You're working on a data storage system for a library to keep track of the books on its shelves. The library has a fixed amount of shelf space to work with (for convenience here, we're going to assume all books take up the same amount of shelf space), so they don't expect their collection to expand, though old books may be swapped out for new ones from time to time. The biggest concern is finding books in the system and flagging them as either in the library or out on loan. Every day, the library's system must handle many transactions of looking up a book and flagging it as either in or out. Since people have to wait at the counter for the system to finish processing and the old computers available to the library aren't the fastest, time efficiency during these operations is a priority. You've been assigned to work on the data structure and functions that will support this library system. Each book is stored with a name (there can be duplicates), an author's name, a boolean that flags the book as either out or in, and a unique ID integer. These ID integers are tied to spaces on the library's shelves and start at 0, so they can also be used to retrieve and return a book when someone checking it out at the counter requests it. The available functions should include checking out, returning, checking the status of, and getting the name and title of a book based on its ID. It should also be possible to remove an old book from a given shelf spot, put a new book into an empty spot, or swap an old book for a new book, all also based on the ID. Finally, it should be possible to check how many books the library owns, currently has in, and currently has lent out. A reasonable amount of error-handling should be expected throughout, though no specific instructions are given here. You must submit one Java file that provides this functionality, though it may include more than one class. The test class must demonstrate all of the desired functions, though you're free to define and load as many test books into your library system as you believe the tests need. Your written answer for this question must explain why your choice of data structure matches the needs of this scenario. You should include an asymptotic run-time analysis for each of your functions, and explain how these match the needs of the libraryStep 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