Question: can someone help me with java program 1) (20/30pts.) - In this assignment, you will be responsible for creating a random number guessing game with




can someone help me with java program
1) (20/30pts.) - In this assignment, you will be responsible for creating a random number guessing game with a twist. Rather than the computer generating and hiding a number from the player (as is typical), the player will instead choose a number which the computer will attempt to guess. Using prompts that inform the computer whether its guesses are high or low (or that it needs to guess higher or lower), your program should intelligently adjust its guessing range to narrow in on a solution. The program should: 1) Ask user to type lower bound (lb) and upper bound (ub) of a random number. If ((ub-lb= 20. Please input lower bound: 10 Please input upper bound: 40 I guess, the answer is 38 The answer is (h=higher than 38, I=lower than 38, c=38): ! I guess, the answer is 25 The answer is (h=higher than 25, I=lower than 25, c=25): g Please re-type. The answer is (n=higher than 25, I=lower than 25, c=25): L I guess, the answer is 10 The answer is (h=higher than 10, l=lower than 10, c=10): h I guess, the answer is 18 The answer is (h=higher than 18, I=lower than 18, c=18): C I am a genius computer!! Play again? (Y/N) Y Please input lower bound: 10 [...] Play again? (Y/N) N Thanks for playing! Bye. A sample log (when the player lies) Please input lower bound: 10 Please input upper bound: 40 I guess, the answer is 38 The answer is (h=higher than 38, I=lower than 38, c=38): h I guess, the answer is 40 The answer is (h=higher than 40, l=lower than 40, c=40): h Do not cheat! I will report to Professor Kim. Play again? (Y/N) Y Tips: - String class methods from chapter 4 may be used to parse user inputs. - The next() method of the Scanner class may be used to read a string from the console. Be sure to import java.util.*. - The chapter 5 case study will be of particular relevance to this assignment. - If the computer is informed that its guess was incorrect, ideally the guessed value should not be within the next range
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
