This is not a place to get others to do your homework for you. You need to do the work and, if you encounter a specific issue, ask a specific question about that. Your post should contain a FULL and CLEAR explanation of the problem, including what you're trying to achieve, how you're trying to achieve it and what happens when you try, then the title should be a summary of the issue. Your title is as much use as no title at all and your post doesn't indicate that you have made any effort at all on your own behalf.
You should start trying to solve any programming problem by forgetting that it's a programming problem. Work out the logic first, then write code to implement that logic. If you had to do this task manually, how would you do it? I bet you'd have little problem doing it so you know how to do it. Write that down. Break it up into smaller and smaller steps and formalise those steps until you have an algorithm, then write code to specifically implement that algorithm. If you come here with a question, you should be able to point to the specific step in that algorithm that you're having trouble implementing.