syed,
I agree with Jan. This is not the appropriate forum for your question and even if it was, you would gain nothing from your homework assignment if we provide the answer.
However, before you post this to another forum, I suggest you employ a flowchart to help you figure out how to solve the problem. Creating a flowchart of the logic steps is a great aid in getting your thoughts together. I still use them.
If you still need help try this forum: http://social.technet.microsoft.com/Forums/en-US/whatforum/threads.
John