@reddy1754
How does giving code to the OP help the OP think through his problem and come up with a solution?
See: http://www.javaprogrammingforums.com/cafe/9544-problem-spoon-feeding.html

If...