Intro to Java Classwork: Number Guessing Game
Write a Java "number guessing" game contained in a single file (named
"NumberGuessingGame.java") in which the computer randomly generates a
positive integer, and then the player is allowed to try to guess the
number.  After each guess, the computer should tell the player whether
the guess was too high, too low, or just right (the correct number).
Every time you ask the player to enter a guess, you should also tell
the player how many allowed guesses remain (see the next paragraph).

At the start of the program, the player should be prompted to choose the
lower and upper boundaries (the range from which the randomly-generated
number will be chosen), with a maximum upper boundary of one million.
The player should also be asked how many guesses are allowed (up to 20)
before the computer reveals the chosen number (if not correctly guessed
by the player).  All player input should be positive integers, and the
upper boundary must be larger than the lower boundary.  Be sure to ask
for the lower boundary first, then for the upper boundary, and then for
the number of allowed guesses.

Your program does not need to error trap for illegally-formatted player
input (i.e., non-integers) or missing data (player presses ENTER without
entering anything).  However, your program does need to check for all
out-of-bounds entries (see above) for all player-inputted values.  If
such a value is entered, your program should display an appropriate
message and the player should be required to re-enter the value.  If
the player enters an out-of-range guess, make sure that guess does not
cause the remaining number of allowed guesses to decrease.

In your program you should create a separate method to get the three
initial values from the player, a separate method to choose the random
number that the player needs to guess, and a separate method with the
main game loop (where the player enters guesses and is given feedback).
If you wish, all other code may go into the 'main' method.  Other than
the 'Scanner' class, you may not import or use any external methods.
However, you may use global variables in your program.

Note that your program must not call any method from within itself.
Also, your program must not have any while loops that contain fixed
boolean conditions (e.g., "while true" or "while false").  And, the
commands "break" and "System.exit()" must not appear anywhere in your
program.

An example run of my program is shown below.  Your output does not need
to look exactly like mine, but your program should function in the same
manner as my program in accordance with the directions above.


As always, all of your code must be your own, written entirely and
only by you within your online CodeHS.com account.  You must never
copy/paste, receive, view, or in any way use code that was created
or modified by another person, entity, or artificial intelligence.


Example Program Run (Includes Advanced Option #1)
Welcome to Dave's Number Guessing Game!

Enter a lower boundary (integer greater than zero and less than one million): -3
The lower boundary that you entered is out of range!

Enter a lower boundary (integer greater than zero and less than one million): 1000000
The lower boundary that you entered is out of range!

Enter a lower boundary (integer greater than zero and less than one million): 0
The lower boundary that you entered is out of range!

Enter a lower boundary (integer greater than zero and less than one million): 10

Enter an upper boundary (integer greater than low bound and <= one million): 10
The upper boundary that you entered is out of range!

Enter an upper boundary (integer greater than low bound and <= one million): 1000001
The upper boundary that you entered is out of range!

Enter an upper boundary (integer greater than low bound and <= one million): 20

Enter the number of guesses that should be allowed (positive integer <= 20): 21
The guesses allowed that you entered is out of range!

Enter the number of guesses that should be allowed (positive integer <= 20): 0
The guesses allowed that you entered is out of range!

Enter the number of guesses that should be allowed (positive integer <= 20): 3

You have 3 guesses left.
Guess an integer from 10 to 20:  15
Your guess was too low.

You have 2 guesses left.
Guess an integer from 10 to 20:  21
Your guess was out-of-bounds...try again.

You have 2 guesses left.
Guess an integer from 10 to 20:  9
Your guess was out-of-bounds...try again.

You have 2 guesses left.
Guess an integer from 10 to 20:  18
Good job...you guessed the chosen number!

Would you like to play again with the same parameters (y/n)?  y

You have 3 guesses left.
Guess an integer from 10 to 20:  15
Your guess was too high.

You have 2 guesses left.
Guess an integer from 10 to 20:  13
Your guess was too high.

You have 1 guesses left.
Guess an integer from 10 to 20:  11
Your guess was too low.

You have run out of guesses!
The chosen number was 12.

Would you like to play again with the same parameters (y/n)?  n


Advanced Option #1
After each game is over, have your program give the player an
opportunity to play another round using the same player-chosen
values, but with a new computer-generated random number.

Advanced Option #2
Expand the advanced option above so that, in addition to giving
the player an opportunity for another round with the same
player-chosen values, also give the player a chance to choose
entirely new values (new low bound, high bound, and number of
allowed guesses).