My code compiles correctly. After entering the employee name, it repeats Enter hourly rate without letting me input data. Where have I gone wrong?
// Payroll Program Part 2 import java.util.Scanner; //uses class scanner import java.io.PrintStream; public class PayrollProgramPart2 { // begin execution public static void main( String args[] ) { // create scanner Scanner input = new Scanner(System.in ); double number1; //input double number2; //input double sum; //sum of 1 and 2 boolean end = false; //is input stop while (end == false) // end is false proceed { number1 = -1; both are -1 number2 = -1; both are -1 String name; System.out.print( "Enter Employee name:" ); //prompt name = input.nextLine(); if(name.toLowerCase() == "stop") end = true; // stop is detected while loop while(number1<0) // since I set it at -1 ahould loop until a postive number is put in System.out.print( "Enter hourly rate:" ); //prompt number1 = input.nextDouble(); // read first number while(number2 < 0) // same as number1 { System.out.print( "Enter number of hours:" ); // prompt number2 = input.nextDouble(); // read second number } sum = number1 * number2; //multiply numbers System.out.printf (" Weekly Pay for%S is $ %.2f\n", name, sum); // Wage } // end } // end } //end } // end