/** Guessing Game Write an interactive Java program called GuessingGame.java It starts by choosing a random number between 0 and 1023 (inclusive), then repeatedly prompts the player to enter a guess at the number. If the player guesses the correct number, a congratulatory message is printed. Otherwise, the program just displays a message saying whether the player's number was too high or too low. The goal is to guess the number in as few tries as possible. Here is an example of a game: I'm thinking of a number between 0 and 1023. Can you guess it? 500 No! Too low. Can you guess it? 600 No! Too high. Can you guess it? 550 No! Too high. Can you guess it? 530 YES! YOU GOT IT IN 4 TRIES! For the first version of your program have 1024 as the default max, but in a second version also allow the user to supply another max as a command-line argument, if they want to. Reading from standard-input is actually rather tricky in Java, so you may find the following helpful: */ import java.io.*; public class GuessingGame { public static void main(String[] args) { int max = 1024; BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); // YOUR CODE HERE for allowing different max value // to be supplied on the command line // lookup Math.random() in the online docu int target = (int)(max * Math.random()); // // YOUR CODE HERE // } public static int getIntPrompted(String prompt, BufferedReader input) { try { System.out.print(prompt); String text = input.readLine(); return Integer.parseInt(text); } catch (Exception e) { System.out.println(" That was not a proper number, try again."); return getIntPrompted(prompt,input); } } }