attached is a question in a programming language that needs a code, screen shot of the run and a description for the code

attached is a question in a programming language that needs a code, screen shot of the run and a description for the code it could be Java…..or C++ it may be less than one page this is a sup program The code should be very simple and not complicated A small program that present the question with the output that give a solution for this question attached is the questions from the book and I need the solution for question # 9 Java and please don't forget to make it as simple as you can + the program description + the output screenshot