title: Java Repeat Compare Value with Array Double and Repeat After Wrong Input
body: <p>When user input value pay rate, it will check the value pay rate with the array of pay rate. If correct then it will prompt if user has another process need to be done. If not, it will go to calculation.</p>
  
  <p>If the pay rate is wrong, then it will display wrong and ask the user to enter value again.</p>
  
  <p>I have problems where after user press the 'Y' it will display 'the wrong pay rate, please try again'. </p>
  
  <pre><code>public static void main(String[] args) {
  
      //Scanner
      Scanner read = new Scanner(System.in);
  
      //Array of payRate Default
      double[] payRateDefault = {3.50, 4.00, 4.50, 4.75, 5.00, 5.25, 5.50, 5.75, 6.00};
  
      double payRateEntered;
      boolean isPayRate = false;
  
      char anotherProcess;
  
      System.out.print("Enter hours work: ");
      int hoursWork = read.nextInt();
  
      do {
          System.out.print("Enter pay rate: ");
          payRateEntered = read.nextDouble();
  
          for (int i = 0; i &lt; payRateDefault.length; i++) {
  
              if (payRateDefault[i] == payRateEntered) {
  
                  //If the payRate is true with array payRateDefault, proceed to ask if you have another employee
                  System.out.println("Do you have any employee to process (Y/N)");
                  anotherProcess = read.next().charAt(0);
                  isPayRate = true;
  
                  //Check if Y or N
                  switch (anotherProcess) {
                      case 'Y':
                          //Proceed back to prompt user to enter pay rate
  
                          break;
                      case 'N':
                          //Proceed to calculation
  
                          break;
                      default:
                          //If wrong input
                          System.out.println("Please use Y or N only");
                          break;
                  }
              } else {
                  isPayRate = false;
              }
          }
          System.out.println("You have entered the wrong pay rate. Please try again");
      } while (!isPayRate);
  }
  </code></pre>
  
  <p>Result:</p>
  
  <p><a href="https://i.stack.imgur.com/s9QQO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s9QQO.png" alt="enter image description here"></a></p>