title: i need to output the final part of my JAVA program which is just a game over string , how can i insert it?
body: <p>these is my program i need to output &quot;game over&quot; if the user enter the string no instead of yes, right now it only works with the yes but i dont know how to add the other option the game is suppose to ask the user for a seed , then for a number from 1 to 100 and then the user has to guees the number, once the user guesses the number it asks if it wants to play again, with option of yes or no, i have the yes but i dont know how to output the no.</p>
  <pre><code>import java.util.Random;
  import java.util.Scanner;
  
  public class GuessANumber_part2 {
      public static void main(String[] args) {
          //Method generates a random number and per user's
          //input it prints if is to low, to high or the 
          //correct number
          guessNumber();
      }
      public static void guessNumber() {
          //Generating a seed number 
          System.out.println(&quot;Enter a seed:\n&quot;);
          Scanner scanner = new Scanner(System.in);
          int seed = scanner.nextInt();
          
          //variable counts number of guesses
          int guess;//variable holds user's guess
          boolean play = true;//variable to run while 
          
          //Generating random object
          Random random = new Random(seed);
          int correctNum = random.nextInt(100) + 1;
          
          //Outer loop count the amount of guesses
          //Prompts user to play the game again
          while(play) {
              //welcome statement, getting the initial input
              System.out.println(&quot;Welcome!\n&quot;
                + &quot;Please enter a number between 1 and 100:&quot;);
              
              //variables 
              guess = scanner.nextInt();//saves the initial input
              int count = 1;//count the number of guesses
              
              //Inner loop outputs if the number given by the user 
              //is either to high, to low or if is the correct number 
              while( guess != correctNum) {
                  if(guess &lt; correctNum) {
                      System.out.println(&quot;Too low. Guess again:&quot;);
                  }else if(guess &gt; correctNum) {
                      System.out.println(&quot;Too high. Guess again:&quot;);
                  }
                  count++;// keeps count of N of guesses
                  
                  //welcome message and input statement 
                  System.out.println(&quot;Welcome!\n&quot;
                    + &quot;Please enter a number between 1 and 100:&quot;);
                  guess = scanner.nextInt();
              }
              
              //outer loop statement,Prompts the user to run or 
              //not run game again 
              System.out.println(&quot;Congratulations. You guessed correctly!\n&quot;
                + &quot;You needed &quot; + count + &quot; guesses.\n&quot;);
              System.out.println(&quot;Do you want to play again? Answer \&quot;yes\&quot;&quot;
                + &quot; or \&quot;no\&quot;:&quot;);
              
              //Output statement sets play to answer &quot;yes&quot;
              play = scanner.next().toLowerCase().equals(&quot;yes&quot;);
          }       
      }
  }
  </code></pre>