Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you help me with this code. I'm supposed to use while and for loops to solve it. public class LinkedBookList { private BookNode head;
Can you help me with this code. I'm supposed to use while and for loops to solve it.
public class LinkedBookList { private BookNode head; private int size; public LinkedBookList()5 head = null; size-e; //returns size of the list public int size(){ return size; //IMPLEMENT -- adds a book to the end of the linked list public void add(Book b)( BookNode anew BookNode(b); head ; BookNode current if ( headnull ) 1 head a; return ; while (current . getNext ( ) != null ) { currentcurrent.getNext() ; current.setNext(a); //current-last element return; //IMPLEMENT -- adds a book at the specific index, // or at the end if index is greater than size public void add (Book b, int index) return; //IMPLEMENT -- removes a book and returns it, or // returns null if book is not present public Book remove (Book b){ return nullStep 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