title: Asking the user if they want to give multiple inputs
body: <p>Im working on an assignment for an intro to java class and having some difficulty accounting for a situation when a user needs to give multiple inputs.  The problem is given as follows:</p>
  
  <p>"Ask the user to input a number. You should use an input dialog box for this input. Be sure to convert the String from the dialog box into a real number. The program needs to keep track of the smallest number the user entered as well as the largest number entered. Ask the user if they want to enter another number. If yes, repeat the process. If no, output the smallest and largest number that the user entered.</p>
  
  <p>This program outputs the largest and smallest number AT THE END of the program when the user wants to quit.</p>
  
  <p>Also, your program should account for the case when the user only enters one number. In that case, the smallest and largest number will be the same."</p>
  
  <p>My issue is that I cannot figure out how to make the program continuously ask the user if they want to input another number....for as many times as they say yes (obviously).  I know I will have to use a loop or something, but I am a beginner with this and do not know where to start. Any help would be appreciated, and thanks in advance!</p>
  
  <p>Here is what I have so far:</p>
  
  <p>package findingminandmax;</p>
  
  <p>import javax.swing.JOptionPane;</p>
  
  <p>public class Findingminandmax
  {</p>
  
  <pre><code>public static void main(String[] args)
  {   
         String a = JOptionPane.showInputDialog("Input a number:");
         int i = Integer.parseInt(a);
  
         String b = JOptionPane.showInputDialog("Would you like to input another number? yes or no");
  
         if ("yes".equals(b)) { 
          String c = JOptionPane.showInputDialog("Input another number:");
          int j = Integer.parseInt(c);
  
          int k = max(i, j);
  
         JOptionPane.showMessageDialog(null, "The maximum between " + i +
                 " and " + j + " is " + k);
  
      }  else {
             JOptionPane.showMessageDialog(null, "The maximum number is " + i );
         }
  
  }
  
  public static int max(int num1, int num2) {
      int result;
  
      if (num1 &gt; num2)
          result = num1;
      else
          result = num2;
  
      return result;
  }
  </code></pre>
  
  <p>}</p>