guess
Category: Programming
Author: Benson Limketkai
Book Chapter: 5.4
Problem: guess
Write a static method named guess that accepts two integers as parameters: a number to guess and how many tries the method gets to guess the number. The method will guess random numbers in the range of 1 to 10 (inclusive) and print them as it guesses them. If the method guesses the number, it will print "I got it!" and then return true. If it fails to guess the number in the requisite number of tries, it will print "I give up!" and then return false. You may assume that the number of tries given is a non-negative number. Call | Prints | Returns guess(2, 5); | 7 10 4 7 6 I give up! | false guess(5, 0); | I give up! | false guess(1, 10); | 2 1 I got it! | true guess(-3, 3); | 9 6 2 I give up! | false guess(6, 6); | 10 10 3 6 I got it! | true As this method has an element of randomness to it, you are to copy the format of the output, not the exact output of the sample calls.