Welcome to JavaRanch.
JavaRanch is
NotACodeMill, so you'll need to write this code yourself. But we'll gladly help you learn enough that you can do that.
But first, since this question has nothing to do with the SCWCD exam -which is what this forum is all about- I'll move it to a more appropriate forum.
CarefullyChooseOneForum