unreachable statement error
Could you please help me figure out what the problem with my code is? I get: C:\Documents and Settings\Sandy\My Documents\Payroll2.java:31: unreachable statement
System.out.println( "Enter Hourly Rate: "); // prompt
^
1 error
when I compile this:
// Payroll2.java
// A Payroll program with a while loop
// that continues until "stop" is used as the name
import java.util.Scanner; // program uses class Scanner
public class Payroll2
{
// main method begins execution of java application
public static void main(String args[])
{
// create a scanner to obtain input in command window
Scanner input = new Scanner( System.in );
String employeeName; // Name of employee
double hourlyRate; // Amount made in one hour
double hoursWorked; // Number of hours worked in one week
double weeklyPay; // The multiple of hourly rate and hours worked in one week
// while method employed to enter emplyee's name
while ( "employeeName" != "stop")
{
System.out.println("Enter an employee name(Input 'stop' when finished)\n\n"); //prompt
employeeName = input.nextLine(); // read employee name or stop
} // end while
// if...else method used to input hourly rate as a positive double
System.out.println( "Enter Hourly Rate: "); // prompt
hourlyRate = input.nextDouble(); // read hourly rate
if ( hourlyRate <= 0)
{
System.out.println( "Hourly Rate incorrect, please try again\n"); // error message
}// end if
else
{
System.out.println( "Correct Hourly Rate input, thank you\n\n"); // confirmation message
} // end else
// if...else method used to input hours worked
System.out.print( "Enter Hours Worked: "); // prompt
hoursWorked = input.nextDouble(); // read hours worked
if ( hoursWorked <= 0)
{
System.out.println( "Weekly hours worked is incorrect, please try again\n"); // error message
}// end if
else
{
System.out.println( "Correct weekly hours input, thank you\n\n"); // confirmation message
} // end else
// calculate weekly pay
weeklyPay = hourlyRate * hoursWorked; // multiply numbers
// display employee name and weekly pay
System.out.printf( "Weekly Pay for %s,is $%.2f\n", employeeName, weeklyPay);
System.out.println( "Thank you for using Payroll2\n"); // good bye message
} // end method main
} // end class Payroll2

