Write a program that has the user enter a number between a searchMin of 1 and searchMax of 100

Write a program that has the user enter a number between a searchMin of 1 and searchMax of 100 inclusive. 
Write a function that tries to guess the number and returns the number of guesses that it took to find the user’s number. Pass the number entered by the user to the function. 
The function should make an initial guess of: guess = (searchMin + searchMax) / 2 ….(first guess will be 50) If the guess was greater than the number the next guess should be found by: Setting the searchMax to (guess - 1) then guess = (searchMin + searchMax) / 2 If the guess was LESS than the number the next guess should be found by: Setting the searchMin to guess + 1 then guess = (searchMin + searchMax) / 2 This process should repeat (LOOP) until the number is found. 

Each guess by the computer should be output to the screen with the sequential guess number(1,2,3 etc) and counted. Print the total number of guesses once after the number is found. The function should return the guess count to the main method. 
(Note: no number will take more than 7 guesses to be found and all number should be found) Include a loop in the main method that will allow the user to enter additional numbers for the computer to guess. Include a mechanism to end the loop and exit the program when the user no longer wishes to enter numbers. Print the total of guesses used for all numbers entered by the user. Use standard techniques. Include an opening and closing statement to the user
 

 
 
Powered by