Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C ) Doubly Linked - List ( double linked - list code can be found in the Assignment 5 _ C IntelliJ project )
C Doubly LinkedList double linkedlist code can be found in the "AssignmentC IntelliJ project
Your task for Part C is to fully implement the "FishLinkedList" class. The FishLinkedList class is a
doubly linkedlist that holds Fish objects. The start of the doubly linkedlist is "head", the end is
"tail".
The fixed stack methods that need to be implemented are as follows:
private boolean containsFish fish
Returns true if the Fish parameter "fish" is already in the doubly linkedlist, false if not.
public boolean addFirstFish fish
Adds the Fish parameter "fish" to the beginning of the linked list unless that fish is already
in the doubly linkedlist. Return true if the Fish is added, false if the Fish was not added
because it is already in the list.
public boolean addLastFish fish
Adds the Fish parameter "fish" to the end of the linked list unless that fish is already in
the doubly linkedlist. Return true if the Fish is added, false if the Fish was not added
because it is already in the list.
public boolean addint index, Fish fish
Adds the Fish parameter "fish" to the linked list at the specified "index", unless that index
is beyond the end of the doubly linkedlist or that fish is already in the doubly linkedlist.
Return true if the Fish is added, false if the index is beyond the end of the doubly linked
list or if it is already in the list.
public Fish removeFirst
Remove and return the first Fish in the doubly linkedlist. Return null if the list is empty.
public Fish removeLast
Remove and return the last Fish in the doubly linkedlist. Return null if the list is empty.
public Fish removeint index
Remove and return the Fish at the specified "index". Return null if the index is beyond
the end of the doubly linkedlist or if the list is empty.
public Fish getint index
Return but do not remove the Fish at the specified "index". Return null if the index is
beyond the end of the doubly linkedlist or if the list is empty.
The "main" method in the Assignment class will test your BookFixedStack implementation, and will
indicate passfail at each step.
Step 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