Learning Objectives: Implementation of linked lists and related operations. Additional practice with classes, to include abstract classes. Practice implementation of generic classes. Students will...


Learning Objectives: Implementation of linked lists and related operations. Additional practice with classes, to include abstract classes. Practice implementation of generic classes.






Students will create a linked list structure that will be used to store information about supplies for a grocery store. You will create an Inventory abstract class with shared attributes and 2 inventory subclasses (i.e. frozen food, produce, deli..).Instead of using ArrayList for storing inventory data, the new program will use a linked list.Note that you willNOTbe using the existing Java class LinkedList, you will be using the provided linked list code and modifying it.Demonstrating your code for two subclasses is required.The program will use the linked list structure to do the following functions;


1) add to the front


2) add to the end


3) remove from end.The program must throw an exception if the program attempts to remove an item from an empty list.


4) remove from the front


5) search for an item by index number (the number of its position in the list) and display the information for that library item.The code must validate that the index number is within bounds and throw an appropriate exception if not.


6) print all items in the library (print out both lists) and the total number of items






You are provided with a generic program called "MyList" which provides some of the required capabilities and prints the list contents (remember that you must override the ToString in each subclass in order for this print method to display the contents as a string).Note that the provided code uses a loop to traverse the list in order to print.A similar traversal loop can be used to search for a specific index. Once a specific index is found it can be used to display the contents of the node.A “size” method is also included as an enabler for your additional methods.






You will add the additional functions to the MyList program.In addition, you will create your own InventoryTest program that creates 2 inventory item lists (one for each subclass) and demonstrates all of the required program functions. Make sure to include all your program files and execution screenshots demonstrating all requirements. To demonstrate the add and remove operations, you should display the list before the operation and just after to show the operation was successfully completed. The display of the list should include the total number of items.To display item 5) "search for an item" you can add a label to the item display, for example "item at index 1 is “. Don’t forget to include demonstrating the exception and related message for attempting to remove an item from an empty list.

Nov 01, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here