Solving Basic Core Java and Functional programs using scanner , random , math.random , if else , for loop and while loop