Please see the following link:
Stuck on Homework? How to Program