Welcome to JavaRanch.
This sounds like a homework assignment. Here at JavaRanch we are happy to help you, but you will have to
do your own homework. If we would just write the program for you, you would not learn anything.
So, tell us what you've done yourself so far, show us your code, and then ask specific questions about the point where you got stuck.