Question: Assume the ferrets variable points to a linked list of LLNode. Write code that traverses the list and prints the following. Do not forget to
Assume the "ferrets" variable points to a linked list of "LLNode." Write code that traverses the list and prints the following. Do not forget to consider the case where the list is empty. * The "LLNode" class is in the "2.7 Introduction to Liked Lists" section on Page 115. * The "Ferret" class is to be implemented by you, and it holds "name (String)" and "weight (int)." * You must use your own implementation of the linked list data structure. a. The sum of the weight of the ferrets on the list b. The count of how many ferrets are on the list c. The names of the ferrets on the list in an alphabetical order d. The names of the ferrets on the list in a reverse alphabetical order Hints: - You need only 3 files: (1) LLNode.java (exactly the same as the textbook on Page 115), (2) Ferret.java (minimal like the past BankAccount class), and (3) TestDriver.java (any name) with main() method - Code to add a node to a linked list is on Page 114 - Code to traverse a linked list is on Page 117 - For parts c and d, you need to use another temporary placeholder before the while loop, then output the sorted result after the while loop. [in-class-only extra credits] * 5 points each applied toward the lowest of your single lab/test in the past (not future). e. Insert a ferret into the middle of the list f. Remove a ferret from the middle of the list
*LLNode class:
public class LLNode
protected T info;
protected LLNode
public LLNode(T info) {
this.info = info;
link = null;
}
public void setInfo(T info) {
this.info = info;
}
public T getInfo() {
return info;
}
public void setLink(LLNode
this.link = link;
}
public LLNode
return link;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
