Question: Hey there, i need help with the question below, thank you. Description In this Binary Search Guessing Game, The computer must check for the presence

Hey there, i need help with the question below, thank you.

Description

In this Binary Search Guessing Game, The computer must check for the presence of an integer number in a provided range from start to end (inclusive). At the end of the game, the number is revealed along with the number of tries it took the computer to get the correct number. You should take the number being searched for from user input. The computer should use the binary search algorithm to solve this question.

NOTE:You are provided a range in which the number will be contained.DO NOT CHANGE THE PROVIDEDstartandendVARIABLES.

Input

 n, where n is the number you will search for in the integer array provided. 

Sample Input

 7 

Output

 The number being searched for and the number of tries to find it 

Sample Output

 The number is: 7 It took 4 tries! 

Description

In this Binary Search Guessing Game, The computer must check for the presence of an integer number in a provided range from start to end (inclusive). At the end of the game, the number is revealed along with the number of tries it took the computer to get the correct number. You should take the number being searched for from user input. The computer should use the binary search algorithm to solve this question.

NOTE:You are provided a range in which the number will be contained.DO NOT CHANGE THE PROVIDEDstartandendVARIABLES.

Input

 n, where n is the number you will search for in the integer array provided. 

Sample Input

 7 

Output

 The number being searched for and the number of tries to find it 

Sample Output

 The number is: 7 It took 4 tries! 

the code already provided and that isnt allowed to change is

public class BinarySearchGame

public static void main{String[]args}

int start=1;

int end=10;

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!