Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA !! Q2. [20 ptsl Write the following classes that implement a double Linked List of Strings: 1) Class Word: It includes three instance

IN JAVA !! image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions