Homework Clinic

Science Clinic => Computer Science => Programming and Graphic Design => Topic started by: lindiwe on Aug 30, 2020

Title: The textbook implemented a BookList class that had a BookNode defined as a nested inner class. That ...
Post by: lindiwe on Aug 30, 2020
The textbook implemented a BookList class that had a BookNode defined as a nested inner class.  That is, the linked list, which itself had operations to add a Book to the list, or to traverse and print out the list, used a BookNode class, but the BookNode class was defined inside of BookList rather than imported.  With this in mind, answer the questions below.


What changes would have to be made to the BookList class in order to properly use the separate BookNode class?
Title: The textbook implemented a BookList class that had a BookNode defined as a nested inner class. That ...
Post by: lorealeza77 on Aug 30, 2020
The BookList class would first have to import BookNode class.  Also, now that a BookNode is an external class, the BookList cannot directly access a BookNode's instance data, and so rather than operations such as current = current.next, it would become current = current.returnNext( ) and current.next = node would become current.setNext(node).