I usually don't reply just to concur, but I think it's important here. The whole homework-- thing is completely out of control. Copy-n-paste homework questions are bead because someone is trying to get out of the work.
lbcarey described the problem and showed what they have already tried. There's an honest attempt to solve the problem and they're looking for HELP. Not for someone to do it for them.
How is this any different than someone asking for help with a work project??? Not so long ago there was a discussion about how perlmonks wasn't for people starting to learn Perl. Wonder how it got that reputation? There was much discussion about how to shed that reputation.. this isn't doing it.
Rich