Design pattern sample program to explain the iterator pattern