Program that generates a random integer


Write a Java program that generates a random integer between 1 and 100, and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display "Too high, try again". If the user's guess is lower than the random number, the program should display "Too low, try again". The program should loop until the user correctly guesses the random number. The program should display the number of guesses the user took.

Note: You can use any resource available to you to establish how one generates a random number between 1 and 100 using Java. The following Java code generates an integer between 1 and 100: (int)(Math.random()*100)+1

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Program that generates a random integer
Reference No:- TGS092272

Expected delivery within 24 Hours