Question
JAVA Data Structures Course: SEE IMAGE FOR QUESTION. Classes are below. Here is the WordNode class: ------------------------------------------------------------------------------------------------------------------------- public class WordNode implements Comparable{ // Declaring variables
JAVA Data Structures Course: SEE IMAGE FOR QUESTION. Classes are below.
Here is the WordNode class:
-------------------------------------------------------------------------------------------------------------------------
public class WordNode implements Comparable{
// Declaring variables
private String word;
private WordNode next;
// Constructor
public WordNode(String word) {
this.word = word;
}
// Getter for word
public String getWord() {
return word;
}
// Getter for next
public WordNode getNext() {
return next;
}
// Setter for next
public void setNext(WordNode next) {
this.next = next;
}
// Implementing unimplemented method compareTo
@Override
public int compareTo(WordNode wN) {
// TODO Auto-generated method stub
return word.compareTo(wN.word);
}
// Equals Method
@Override
public boolean equals(Object obj) {
// TODO Auto-generated method stub
WordNode w=(WordNode)obj;
return word.equals(w);
}
}
WORD LIST CLASS:
--------------------------------------------------------------------------
public class WordList{
private WordNode head;
private WordNode tail;
}
WRITE THE FOLLOWING METHOD:
int countLongWords (int length) - Returns the number of words list where the word length is greater than length. Throws IllegalArgumentException with an appropriate message if length is negative. (20 points) in theStep 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