Also, please put code you write into code tags to preserve its indentation and formatting. I heartily recommend reading the "Before you make a query" thread, linked at the upper right of this page.

There is nothing wrong with writing code or rewriting code -- provided that the learner is showing that he or she is putting forth effort to learn. Getting one's homework done entirely for free (or even for a price) is doing a disservice to the poster and to potential employers and coworkers who have to discover that the supposed skills were not actually learned.