I308 C307 Data/Information Representation

I308 C307 Homework 4

Due Date: Monday, February 7, 2022.

Please complete Lab 2 before you start working on the homework. In this homework, you will continue the work on the project started in the lab and add some more functionality to it.

Ex. 1. List Container

a. List traversal Add the following functions to the class List:

Add three more options in the interface in the main where you test these three functions.

Ex. 2. Iterators

In the class ListIterator, add a method called set(int value) that assigns the value to the node current, if this node is not null.

In the class List, add a method called ListIterator end() that returns an iterator containing a reference to the last node in the list. Add another function in this class called decrease. This should be a traversal function using iterators that removes 1 from every node in the list.

In the class Main, add a static function with a list as parameter, using iterators, that outputs the last element in the list. Note that this function doesn't need a loop.

In the interface, add an option to test each of the new functions that were added.

Homework Submission

Upload all four .java files to Canvas, Assignments, Homework 4.