Question: IN JAVA !! Q2. [20 ptsl Write the following classes that implement a double Linked List of Strings: 1) Class Word: It includes three instance
Q2. [20 ptsl Write the following classes that implement a double Linked List of Strings: 1) Class Word: It includes three instance variables: String word, word next and word prev It contains the following methods: o A constructor that initializes the instance variable word. o Set and get method for each instance variable. 2) Class DoubleLinkedList: It includes two instance variables: Word head and Word tail. It contains the following methods: o public void insert (String n) that creates and adds a Word at the end of the linked List. o public void printForwardo that prints the content of the linked ist forward o public void printBackward0 that prints the content of the linked list backward. o public void remove (String n that removes a word if it exists in the list. 3) class TestDoubleLinkedList in the main method, do the following: Create an object of class DoubleLinkedList. sentence). Read a sentence from the user and store it in a variable (for example, String split the sentence into words and store the words in an array. (Hint use method split Insert each word of the array in the linked list method insert. Call method printForward 0 method printBackward 0 printForward Read a string from the user, call method remove and then call me
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
