using an iterator in the showSequence method