My program compiles without any errors, however, when I go to run it all I get is a message saying "Welcome to the Payroll Program". From there it does not print anything else nor allows me to enter any information. If someone could please take a look at my program and let me know what I am overlooking, I'm new to looping and I believe my issue is somewhere within my looping structures. It would be greatly appreciated!! :)
// Fig. 1.1: Payroll Part 2
// Payroll program calculates employee's weekly pay.
import java.util.Scanner;// program to use import scanner
public class PayrollPart2
{
//main method begins execution of java program execution
public static void main( String args[] )
{
System.out.println( "Welcome to the Payroll Program!" );
boolean stop = false; // Loop until user types "stop" as the employee name.
while (!stop);
{
// create scanner to obtain input from command window
Scanner input = new Scanner(System.in );
System.out.println(); // outputs a blank line
System.out.print( "Enter Employee's Name or stop to exit program: " );
String empName = input.nextLine(); // employee name
if ( empName.equals("stop"))
{
System.out.println( "Program Exited" );
stop = true;
}
else
{
float hourlyRate; // hourly rate
float hoursWorked; // hours worked
float weeklyPay; // Weekly Pay for employee
System.out.print( "Enter hourly rate: " ); // prompt for hourly rate
hourlyRate = input.nextFloat();
while (hourlyRate <= 0) // prompt until positive value is entered
{
System.out.print( "Hourly rate must be a positive number. " +
"Please enter the hourly rate again: " );
hourlyRate = input.nextFloat(); // read hourly rate again
}
System.out.print( "Enter hours worked: " ); // prompt for hours worked
hoursWorked = input.nextFloat();
while (hoursWorked <= 0) // prompt until a positive value is entered
{
System.out.print( "Hours worked must be a positive number. " +
"Please re-enter hours worked: " ); // prompt for positive value for hours worked
hoursWorked = input.nextFloat(); // read hours worked again
}
// Calculate Weekly Pay.
weeklyPay = (float) hourlyRate * hoursWorked; // multiply sum
// Display Output Results and sum
System.out.print( empName ); // display employee name
System.out.printf( "'s weekly pay is: $%,.2f\n", weeklyPay); // display weekly pay
}
}
// Display ending message:
System.out.println( "Closing Payroll Program." );
System.out.println(); // outputs a blank line
} // end method main
} // end class PayrollPart2