title: How to ask user if they want to run program again or not?
body: <p>I already have the code for the scanner but I don't know how to make the code so that you can ask the user whether to run the program again or not. My program is for the <a href="http://en.wikipedia.org/wiki/Pig_Latin" rel="nofollow">PigLatin</a> (a constructed language game in which words in English are altered according to a simple set of rules).</p>
  
  <p>I have to make it so that it will ask the user if he/she wants to translate another phrase and wait for the user to enter "Y" or "y" as yes, "n" or "N" as no. If yes, run program again. If no, exit the program. For all other letters, reject it and ask the user to enter only "y" or "n".</p>
  
  <pre><code>public static void main (String[] args) {
      Scanner keyboard = new Scanner(System.in);
  
      System.out.print("Please enter an English phrase or sentence :");
  
      String sentence = keyboard.nextLine();
      System.out.println("\"" +sentence+ "\"" + " ");
      Scanner word = new Scanner(sentence);
      System.out.println("In PigLatin that would be: ");
      while (word.hasNext()) {
          String pigLatin = word.next();
          System.out.print(convertPigLatinWord(pigLatin));
      }
  }
  </code></pre>