Don't ask for full code solutions on this forum please. We are here to help you do your work, not do it for you. Show us what you have tried, and we can try to help you, but we won't do your assignment/homework for you.
EDIT:
Also, do not double post your questions. If you can't find your original question, look at
My Subscriptions. This is located at the top, under "My Stuff." If you think that your question has been forgotten about, you can reply to the original question (after a reasonable amount of time: about 24hrs) to bump it back to the top. But multiple threads becomes confusing for you and the experts.
I have merged your threads.
Please read and follow the
Posting Guidelines.
MODERATOR