//The function removeBook searches for the stock number //of a Book Record and removes that book from the list. public Boolean removeBook(long stockNum) { BookRecord temp = new BookRecord(); BookRecord back = new BookRecord(); if (m_pHead == null) //CHecks if there is anything in the list { return false; } temp = m_pHead; back = null; while((temp != null) && (stockNum != temp.getStockNum())) //The function moves down the list { back = temp; temp = temp.getNext(); } //If the list has reached the end and no book is found, a message is printed if(temp == null) { Console.WriteLine("Book not Found."); return false; } else if (back == null) //If the book is at the head, head points to the next node and the book is removed { m_pHead = m_pHead.getNext(); temp = null; } else //If the book is not at the head, the node before the target is set to the node after the target { back.setNext(temp.getNext()); temp = null; //he target is deleted. } return true; }