Lab 4 Solution

$30.00

Category: Tag:

Description

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.

  1. Create a Linked List class with the following:

    1. Embedded Node class with the following data members

      • Comparable data

      • Node next

    1. Embedded Node class with the following methods

      • Node(Comparable d)

      • Node(Comparable d, Node n)

    1. Private data members:

      • Node head

      • int size

    1. The following methods:

      • See CSCD211Lab4 The main method has 13 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

  1. 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 cscd211Lab4out.txt.

.

Name your zip file your lastname first letter of your first name lab4.zip (Example: steinerslab4.zip)


error: Content is protected !!