Well, theoretically - yes. We can give you code. But we don't like to do it(and hopefully - nobody will). It is because as a beginning programmer, you have to learn that YOU create code. If you only use code that somebody else created - you are as good ac ctrl+c ctrl+v combination.
So what should you do? Try to do it by yourself. If you come up with idea, and say "okay, so it's not working, please help" - and give us your code(using code tags) - it's nice start. What is better start? Comment your code as deeply as you can - not with // , but by posting it. Tell us what your code does. Step by step. It can also make it simpler to read it. Tell us what you think your code is doing, what it should do, where you think error is.
Every time I encounter a bug I can't fix, I spend much time looking for a bug. I try to find it, and only if I really can not - I start writing a post... And I have never posted a single question about finding bug since I used method described above. If you understand what your code does and explain step by step, you will eventually find what is wrong in your code. I encourage you to do the same. You never learn as much as when you do something by yourself.
Also, your question is not clear about what you want to achieve. Fix things I explained in my post, and you will have high chance of getting an answer.