Thanks TRon
If you are able to 'fix' the structural issues, then we can help you with actual implementation related issues.
Because you are doing a homework assignment we simply can't provide a literal answer (well, we could but what good would that do you).
That means that in case your code isn't exactly doing what you expected it to do then please ask explicit questions (even if you do not know the exact words, then try to describe it), by describing the problem (what you have written, what you expected the code to do and what the code is actually doing (wrong) for you. That way you are able to get the quickest answer (and learn the fastest).
I added the tags for clarity
There you go, looking a lot nicer don't you think ? :-)
Are you still presented with the same error ? Because that could suggest there is something wrong that is not even related to code whatsoever.
fwiw: if i copy-paste the code (between the code-tags) you just posted then there is nothing wrong with it. In worst case, copy-paste it yourself back in your editor and save it before compiling.