title: Looping two inputs until the user has finished entering
body: <p>I'm trying to loop these two questions("please enter direction") AND ("Please enter distance in miles"). If incorrect value is inputed then it will reprompt the user to enter a correct value. So these two questions will loop until the user is done entering and a "Destination" is reached. I got the first question to loop if the user doesn't type north east south or west, but the second question I could only make it loop on itself.</p>
  
  <pre><code>boolean reprompt = true;
  //Prompt for direction and miles
  
  while (reprompt) {
  
     directions = JOptionPane.showInputDialog(null, "Please enter a direction: ");
     if (directions.equalsIgnoreCase("East")) {
        finalxCoord = finalxCoord + numOfMiles;
        reprompt = false;
        }
        else if (directions.equalsIgnoreCase("West")) {
                 finalxCoord = finalxCoord - numOfMiles;
                 reprompt = false;
                 }
               else if (directions.equalsIgnoreCase("North")) {
                       finalyCoord = finalyCoord + numOfMiles;
                       reprompt = false;
                       }
                       else if (directions.equalsIgnoreCase("South")) {
                               finalyCoord = finalyCoord - numOfMiles;
                               reprompt = false;
                               }
               else {
                   reprompt = true;
                   JOptionPane.showMessageDialog(null, error);
               }    
          }
  
     numOfMiles = Double.parseDouble(JOptionPane.showInputDialog(null, "Please enter distance in miles: "));
     if (numOfMiles &gt; 0) {
     totalMiles += numOfMiles;
     JOptionPane.showMessageDialog(null, "miles: " + totalMiles);
  
  
     }
     else 
     JOptionPane.showMessageDialog(null, error);
  </code></pre>