Question: Write the following classes that implement a double Linked List of Strings: Class Word: It includes three instance variables: String word, Word next and Word

 Write the following classes that implement a double Linked List of

Write the following classes that implement a double Linked List of Strings: Class Word: It includes three instance variables: String word, Word next and Word prev. It contains the following methods: A constructor that initializes the instance variable word. o Set and get method for each instance variable. Class Double Linked List: It includes two instance variables: Word head and Word tail. It contains the following methods: public void insert (String n) that creates and adds a Word at the end of the linked List. public void print Forward () that prints the content of the linked list forward., o public void print Backward () 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. Class Test Double Linked List. in the main method, do the following: Create an object of class Double Linked List. Read a sentence from the user and store it in a variable (for example, String sentence). Split the sentence into words and store the words in an array. Insert each word of the array in the linked list by calling method insert. Call method print Forward () Call method print Backward () Read a String from the user, call method remove and then call method print Forward ()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!