Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write the program in Java language. Please write it as basic ways as possible, because I am just the beginner of the coding class.
Please write the program in Java language.
Please write it as basic ways as possible, because I am just the beginner of the coding class.
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: I) 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 Your answer is (high, low, correct): high I guess,the answer is 25 Your answer is (high, low, correct): hgh Please re-type. Your answer is (high, low, correct): high I guess, the answer is 10 Your answer is (high, low, correct): 1w I guess, the answer is 18 Your answer is (high, low, correct): correct I am a genius computer!! Play again? Yes Please input lower bound: 10 Play again? N Thanks for playing! Optional criteria: 1) Can you ensure that the computer will not guess the same number twice per session? 2) Add a counter to your program to track the number of turns that have been made. 3) Can you add a function that self-reports whether the guess was low or high, thus removing the human player? 5) Just food for thought, can you imagine what the ideal "guess" pattern might look like? What would be about the maximum number of turns it should ideally take to find an integer between 1 and 1,000,000,000Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started