Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a doubly linked list for storing integers. In doubly liked lists, each node has a connection to its previous and next node. The first
Create a doubly linked list for storing integers. In doubly liked lists, each node has a connection to its previous and next node. The first node is known as the head (the previous for the head is null), and the last node is known as the tail (the next for the tail is null) Your linked list should have the following properties: 1. No need to say that you must create a node inner class in the beginning. 2. addNode ability: it gets an integer and adds it to the end of the list 3. remove node ability: it gets an integer, finds the integer in the linked list, and removes it from the chain. (note that in 1 and 2, you need to break and establish new previous and next connections, and the process for head and tail might be different from a regular node) 4. In the removal process, if the mentioned integer is not stored in any node, your program should throw an exception called ItemNotFoundException with the message: "Entered number is not in the list" You must create an exception class and do all necessary coding related to this design. (No need to handle the exception) 5. ToString method should print the integers in the linked list if it's not empty and a message if it is empty. Examples are shown below. Nodes of doubly linked list: 20 50 Doubly linked list is empty Exception in thread "main" LinkedList. ItemNotFoundException Create breakpoint : Entered number is not in the list at LinkedList. DoublyLinkedList . deleteNode (DoublyLinkedList. java: 39) at LinkedList. DriverDLL. main (DriverDLL. java:19)
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