Starting from:
$30

$24

Lab 5 Solution

A reference-based singly linked list is a basic data structure in computer science. Proficiency with linked lists is part of all CS tracks and represents a substantial portion of the Advancement Programming Exam.




Create a Linked List class with a Dummy Head Node and the following:



Embedded Node class with the following data members



Comparable data



Node next



Embedded Node class with the following methods



Node(Comparable d)



Node(Comparable d, Node n)



Private data members:



Node head



int size



The following methods:



See CSCD211Lab5 The main method has 11 methods taken directly from the Java API. The only difference is E is Comparable and the parameter Object o in the API is also Comparable



BoxCar is the data structure being placed into the LinkedList. A BoxCar only contains a String for its contents.



SOME SPECIFICATIONS




You must check ranges for the menu method



See my docs for the methods in BoxCar



You must ensure all appropriate preconditions – see the API for exceptions



It is expected that you will examine the similar methods in the API for LinkedList. Based on that examination you will throw the appropriate exceptions. You are not at this time required to deal with the exceptions just propagate them



For example anything with an index will throw




IndexOutOfBoundsException - if the index is out of range (index < 0 || index = size())







TO TURN IN




A zip file containing:




All java files necessary to compile and run your program



Include an output file named cscd211Lab5out.txt.
.

Name your zip file your last name first letter of your first name lab5.zip (Example: steinerslab5.zip)

More products