Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C ) Doubly Linked - List ( double linked - list code can be found in the Assignment 5 _ C IntelliJ project )

C) Doubly Linked-List (double linked-list code can be found in the "Assignment5_C" IntelliJ project).
Your task for Part C is to fully implement the "FishLinkedList" class. The FishLinkedList class is a
doubly linked-list that holds Fish objects. The start of the doubly linked-list is "head", the end is
"tail".
The fixed stack methods that need to be implemented are as follows:
private boolean contains(Fish fish)
Returns true if the Fish parameter "fish" is already in the doubly linked-list, false if not.
public boolean addFirst(Fish fish)
Adds the Fish parameter "fish" to the beginning of the linked list unless that fish is already
in the doubly linked-list. Return true if the Fish is added, false if the Fish was not added
because it is already in the list.
public boolean addLast(Fish fish)
Adds the Fish parameter "fish" to the end of the linked list unless that fish is already in
the doubly linked-list. Return true if the Fish is added, false if the Fish was not added
because it is already in the list.
public boolean add(int 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 linked-list or that fish is already in the doubly linked-list.
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 linked-list. Return null if the list is empty.
public Fish removeLast()
Remove and return the last Fish in the doubly linked-list. Return null if the list is empty.
public Fish remove(int index)
Remove and return the Fish at the specified "index". Return null if the index is beyond
the end of the doubly linked-list or if the list is empty.
public Fish get(int index)
Return (but do not remove) the Fish at the specified "index". Return null if the index is
beyond the end of the doubly linked-list or if the list is empty.
The "main" method in the Assignment5_ class will test your BookFixedStack implementation, and will
indicate pass/fail at each step.
image text in transcribed

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

Question May a taxpayer roll over money from an IRA to an HSA?

Answered: 1 week ago

Question

Question What is the doughnut hole in HSA coverage?

Answered: 1 week ago