Show us your code, and ask questions about it.
Then we can help you solving your question.

Now it looks like you want us to do your homework....
And that is not where this forum is for.
On...