title: Runtime Ignoring While Loops?
body: <p>I am new to the forums so first of all I'd like to say "Hi"! I'm new to Java programming and am trying to make a simple payroll calculating program with three while loops.</p>
  
  <p>The first while loop keeps the program going until the user enters the sentinel "stop". The second and third loops are error traps that ensure the user enters a positive number before continuing.</p>
  
  <p>For some reason, the while loops are not working and I have tried every variation I can think of. The program runs just fine, it just ignores the while loops. If someone could provide some suggestions as to what I'm doing wrong, I'd really appreciate it.</p>
  
  <p>I'm using NetBeans 8.0 IDE if that helps.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>Import java.util.*;
  
  Import java.text.*;
  
  public class PayrollProgramVersion2 
  {
  
      //begin main program
      public static void main(String[] args) 
      {
          //declare new scanner
          Scanner sc = new Scanner (System.in); // declare new scanner object
          DecimalFormat Dollars = new DecimalFormat ("$0.00"); //format for dollars
          String Employee; //employee's name
          Double Hours, //hours worked
          Rate, //pay rate
          Pay; // Hours * Rate
          Boolean Continue = true; // sentinel for program loop
          //welcome user, prompt for employee name, and assign input to Employee
          System.out.println ("Welcome to the payroll program!");
          System.out.println ("What is the employee's name? (Enter stop to quit.)");
          Employee = sc.nextLine();
          // while loop continues program until user enters "stop"
          while (Continue == true) 
          {
              if (Employee.equalsIgnoreCase("stop"))
              {
                  Continue = false;
              } // end if
              else
              {
                  //prompt for hours worked and assign to Hours
                  System.out.println ("How many hours did " +Employee+ " work?");
                  Hours = sc.nextDouble();
                  //this block is an error trap to ensure input is positive before continuing
                  while (Hours &lt; 0)
                  {
                      System.out.println( "Error - input must be a positive number");
                      System.out.println ("How many hours did " +Employee+ " work?");
                      Hours = sc.nextDouble();
                  }
                  //prompt for pay rate and assign to Rate
                  System.out.println( "How much does " +Employee+ " make per hour?");
                  Rate = sc.nextDouble();
                  //this block is an error trap to ensure input is positive before continuing
                  while (Rate &lt; 0)
                  {
                      System.out.println( "Error - input must be a positive number"); 
                      System.out.println( "How much does " +Employee+ " make per hour?");
                      Rate = sc.nextDouble();
                  }
                  Pay = Hours * Rate; // calculate payrate
                  //display results
                  System.out.println(Employee+ "'s paycheck is " +(Dollars.format(Pay))+ ".");
                  System.out.println ("What is the employee's name? (Enter stop to quit.)");
                  Employee = sc.nextLine();
              } //end else
          } //end while
          System.out.println ("Thank you for using the payroll program. Goodbye!");
      } // end main
  
  } // end program
  </code></pre>