Back to 211 Main Page

Mobius strip

Assignment 2

The Assignment

http://learnu.ics.hawaii.edu/~nickles/211_Spring_2005/labs/Lab02_Iterators.pdf
[Handed out in class.]

Submission

  • Email your assignment to ztomasze@hawaii.edu.
  • Attach the source code of your Java application. Send me only the source code (.java files); do not include the .class or any other files. Do not zip or otherwise bundle the .java files.
  • Send me MyListIterator.java, DLList.java, and DLLNode.java.

Recommendations

Though we are not implementing MyListIterator the same way the book does, you can still find most of the code for all but 2 of the methods in the book. Note that the book does not use JavaDoc comments to document code, as you need to for this class.

Again, read the full API documentation for the interface you are implementing: ListIterator

Note that the code in the book is using a list that starts indexing at 1. You are using a list that starts indexing at 0. Therefore, the code in the book will need to be changed somewhat.

Most of the code and description given in the assignment comes from the book. Therefore, please make the following corrections to the handout:

  • MyListInterface should be MyListIterator. (You are writing only one file for this assignment--MyListIterator.java).
  • ListInterface should be java.util.List (or just List if you have import java.util.*; or import java.util.List; at the top of your class).
  • In the main method: All calls to names.add(1, ...) should be names.add(0, ...)

Grading:

Out of 10 points:

1 - Compiles
2 - Documentation and Coding Standards
Make sure you document your class and any methods or constructors not specified by the ListIterator interface. Again, you may want to reread the documentation and coding standards guidelines for this class.
1.5 - Traversing methods
hasNext, hasPrevious, next, nextIndex, previous, previousIndex
0.5 - add
3 - set and remove
0.5 Constructor
The constructor should take a reference to a java.util.List object.
1.5 - main
MyListIterator should contain the main method given on the assignment handout.

Here's a short grader program to help you find some of your bugs: ListIterGrader.java (Start thinking about how to write one of these for yourself; I won't always give you one.)

Solution

Zach's Solution. Uses DLList, which you can get from the A1 Solution. Again, this is just one way that this can be implemented.



~ztomasze Index : TA Details: ICS211: Assignment 2
http://www2.hawaii.edu/~ztomasze
Last Edited: 22 Feb 2005
©2004 by Z. Tomaszewski.