this program must be written in java.
in a game of guessing numbers, one person says "i am thinking of a number between 1 and 100". the second person guesses "50". the first person says "no it is less". the second person guesses "20". the first person says "no it is greater". this continues until the second person guesses the number. write a program that plays this game. the computer knows the number (a random number between 1 and 100). the user (the second person) is the guesser. at the end of the program, the computer must displays the number of guesses it took the user to guess the number.
the program must include:
a main class
a loop (for, while or do-while)
an if or if – else statement
must accept input from the keyboard
must have a prompting statement
a separate class with a constructor
at least one method that performs an operation required by the main program
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
here is an algorithm, please make it as simple as you can and still include the necessary rules.
· generate a random number (1-100)
computer = gen random # (1-100)
do (input number (kb reader)
stop = false;
if (mynum = computenum
stop = true
system.out.println(“your number is too high);
system.out.println(“your number is too low”);