Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Solve this wothout using any java collections library Everything should be solved from scractch and implement the best strategy and explain throughly each step and
Solve this wothout using any java collections library
Everything should be solved from scractch and implement the best strategy and explain throughly each step and why used in terms of time complexity or space
Dont make the code too complex so the teacher wont suspect
Note: this practical must be completed using the materials from units You may not use the Java collections library, as introduced in unit
You have been asked to implement a Loan Item System for a local library, which they can operate manually. In this assignment, you will create a prototype system with limited functionality and explain how you have implemented the system in a short design document. The library contains various items for loan: books, magazines, DVDs and CDs These items have attributes: all have a title and a library ID number. Books and CDs have an authorartist whereas magazines and DVDs instead have a publisher. All items are kinds of loanable item which have two further attributes: a flag to indicate if the item is on loan, and a target return date.
Task : Decide on a set of fields and data types for the various attributes described above, eg the target return date could be represented as a string in the format YYMMDD Organise the fields between Java classes andor interfaces to represent each of LoanItem, Book, Magazine, DVD and CD Implement these in code, with appropriate accessors or mutators.
Task : Decide on a data structure to hold the librarys collection of items. You will also need to support sorting of the items. You may like to read ahead to decide what properties your data structure and sorting technique require. In your design document justify your choices eg in terms of features, ease of use, computational complexity, etc Using a test class, create a test collection for the library of items using your chosen data structure. Populate this collection with actual examples, eg for a book: author Tolkien title The Hobbit library id Item onloan? No returndate
The library needs to be able to see its collection printed out as a report. The report must show the library id the items type ie if it is a book, magazine, DVD or CD the items title, if it is on loan and, if so what its return date is The items in the report must be sorted.
Task : Provide a method for sorting the items in your data structure. Write a method which sorts the items into the format described below, and another method to print out the report. Demonstrate these methods and provide some tests to prove that they work correctly.
The items should be displayed in library ID number order, as in this sample report:
Item Book, The Hobbit, no
Item CD Greatest Hits, yes,
Item Magazine, Astronomy Now, yes,
Item DVD Pride and Prejudice, yes,
Task : Modify your prototype so that the report orders items so that the onloan items are listed before those not on loan. The onloan items must be listed in target return date order, and, for items due on the same date, ordered in library ID number order. Provide suitable tests and demonstrate the output report is correct. If you complete this task, comment out but keep the code implementing task where it conflicts with answering task but make sure both answers are covered in your report.
A sample report for task :
Item Magazine, Astronomy Now, yes,
Item DVD Pride and Prejudice, yes,
Item CD Greatest Hits, yes,
Item Book, The Hobbit, no
Task : Provide methods so that the librarians can add or remove items from the collection. When removing an item, they will first need to find it Depending on your choice of data structure, you may need to add additional methods to support these operations. Provide suitable tests and demonstrate the operations work as they should.
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