Question: T The program seems to have a bug! If I enter a number that is greater then 200 and then enter a number that is

T The program seems to have a bug! If I enter anumber that is greater then 200 and then enter a number thatis less then 1 it doesn't print out that the number isout of range! GuessANumber [Java Application] /Library/Java/JavaVirtual Machines/jdk-13.0.1.jdk/Conten Enter a random seed:T

1 Enter a quess between 1 and 200: -1111 Your guess isThe program seems to have a bug! If I enter a number that is greater then 200 and then enter a number that is less then 1 it doesn't print out that the number is out of range!

GuessANumber [Java Application] /Library/Java/JavaVirtual Machines/jdk-13.0.1.jdk/Conten Enter a random seed: 1 Enter a quess between 1 and 200: -1111 Your guess is out of range. Pick a number between 1 and 200. Your guess was too low - try again. Enter a guess between 1 and 200: 10, Your guess was too low - try again. Enter a guess between 1 and 200: 150 Your guess was too low - try again. Enter a guess between 1 and 200: 100000 Your guess is out of range. Pick a number between 1 and 200. Your guess was too high - try again. Enter a guess between 1 and 200: -1111 Your guess was too low - try again. Enter a guess between 1 and 200: import java.util. Random; import java.util.Scanner; public class GuessANumber { public static void main(String[] args) { Scanner scan = new Scanner (System.in); Random ran = new Random(); System.out.print("Enter a random seed: "); int seed = scan.nextInt(); ran.setSeed (seed); int nxt = ran.nextInt(200) + 1; System.out.print("Enter a guess between 1 and 200: "); System.out.print(""); int guess = scan.nextInt(); int numGuess = 1; if (guess == nxt) { System.out.println("Congratulations! Your guess was correct!"); System.out.println(""); System.out.println("I had chosen " + nxt + " as the target number."); System.out.println("You guessed it in " + numGuess + "tries."); System.out.println("That was impossible!" while (guess != nxt) { if(guess > 200) { System.out.println("Your guess is out of range. Pick a number between 1 and 200."); if (guess 200) { System.out.println("Your guess is out of range. Pick a number between 1 and 200."); if (guess nxt) { System.out.println("Your guess was too high - try again."); System.out.println(""); System.out.print("Enter a guess between 1 and 200: "); numGuess = numGuess + 1; guess = scan.nextInt(); if (guess 3 && numGuess 3 && numGuess 10) { System.out.println("Congratulations! Your guess was correct!"); System.out.println(""); System.out.println("Congratulations! Your guess was correct!" System.out.println(""); System.out.println("I had chosen " + nxt + " as the target number."); System.out.println("You guessed it in " + numGuess + " tries."); System.out.println("Not bad, not bad..." if (numGuess = 8) { System.out.println("Congratulations! Your guess was correct!"); System.out.println(""); System.out.println("I had chosen " + nxt + " as the target number. "); System.out.println("You guessed it in " + numGuess + "tries.") System.out.println("That was not very impressive." if (numGuess == 9 || numGuess == 10) { System.out.println("Congratulations! Your guess was correct!"); System.out.println(""); System.out.println("I had chosen " + nxt + " as the target number. " System.out.println("You guessed it in " + numGuess + "tries."); System.out.println("Are you having any fun at all?"); pohlen if (numGuess > 10) { System.out.println("Congratulations! Your guess was correct!"); System.out.println(""); System.out.println("I had chosen " + nxt + " as the target number. " System.out.println("You quessed it in " + numGuess + "tries." System.out.println("Maybe you should play something else.") scan.close()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!