In class we discussed the Queue data structure. Save the following files to your directory:
Now proceed as follows:
The trickiest parts of the array implementation are increaseSize() and iterator(). Remember that the front of the queue may not be at location 0 in the old array, but when you increase the size you may as well put it at location 0 in the new array (it's even more complicated if you don't). So your loop that copies needs to keep track of two sets of indices -- the index in the old array, which will need to wrap around, and the index in the new array, which will start at 0. You will need to do something similar in the iterator, since ArrayIterator assumes that the array elements start at location 0. Here you don't need to increase the size of the array, but you do need to create a new array and copy the elements to it starting at location 0 before passing the array to the ArrayIterator constructor. You do not need to modify the ArrayIterator class.