Please use the highlight tags when posting code.

Also, you've posted a bunch of code and your assignment, but no explanation of what's going on or what your question is. What do you expect this...