Solved Java Write A Method So That The Main Code Below

Solved Java Write A Method So That The Main Code Below