Question: write a guessing game. In this program, you will create an array of 20 elements and write a methods that randomly generates integer values between



write a guessing game. In this program, you will create an array of 20 elements and write a methods that randomly generates integer values between 1 and 100 (inclusive). The method then uses the Java built-in sort function Arrays.sort(myArray) to sort the array in ascending order and returns the sorted array. The program then asks the user to think of an integer between 1 and 100. The program may ask the user a question such as “Is your number bigger than 61?” See below for example sample runs. Your program should have a worst-case time of O(log n), where n is the size of the collection object.

Please for make the output to look similar to the output below


Sample run #1: Value NOT FOUND in the collection (target = 63)Choose a random number between 1 and 100. Enter "Y" for Yesor "N" for No. Is your number bigger than 56: y Is

 

Sample run #1: Value NOT FOUND in the collection (target = 63) Choose a random number between 1 and 100. Enter "Y" for Yes or "N" for No. Is your number bigger than 56: y Is your number = 76: n Is your number bigger than 76: n Is your number = 68: n Is your number bigger than 68: n Is your number = 66: n Is your number bigger than 66: n Is your number = 58: n Is your number bigger than 58: y Is your number = 66: n SORRY! Your number is not in the collection. Here is the Collection: 8, 8, 23, 28, 31, 37, 38, 49, 54, 56, 58, 66, 68, 73, 76, 82, 84, 87, 98, 98,

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!