Hi,
Can anyone tell me why this program is skipping line 63?
Thank you,
lynnajoe
import java.util.Scanner; //Imported Scanner for input
import java.util.Locale; //Imported Locale and NumberFormat
import java.text.NumberFormat;
/**Simple Payroll Program titled PayrollPartI & modified for PayrollPart II
*
* @author Lynn Ortiz
*///May 22, 2011 //Description of program: This program tabulates the base
//salary and overtime pay for employees
//It will exit if "Stop" is entered for an employee name
public class PayrollPartIandPartII {//This is the class for PayrollPartI
//modified for PayrollPartII
private static String name;
//Declared variables
private static float hourlyRate; //Employee
private static float hoursWorked;
private static float regHours = 40;
private static double employeeBaseSalary = hourlyRate * regHours;
private static NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US);
private static boolean isName = true;
private static float overtimeHours;
private static float overtimePay;
private static double employeeWeeklySalary;
public static void main (String []args){ //Beginning of the main method
System.out.println("Welcome to the Employee Payroll Program\n");//Welcome screen
//Blank line
System.out.println("Enter Stop for employee name to exit program\n");//Instructions to exit program
while (isName){
Scanner input = new Scanner(System.in);//The while loop until "Stop" is entered
System.out.print("Please enter employee name: " ); //Prompts for user input
name = input.nextLine();
if (!name.equalsIgnoreCase("stop")){
System.out.print("Please enter employee's hourly rate: "); //Continue loop
hourlyRate = input.nextFloat();
if (hourlyRate < 0){ //If a negative number is input for employee hours or rate and error message prompts
System.out.print("please enter a positive number: "); //user to input a positive number
hourlyRate = input.nextFloat();
}
System.out.print("Please enter employee hours worked: ");
hoursWorked = input.nextFloat(); //Variables for holding values
if (hoursWorked < 0){ //Prompts for user input
System.out.print("Please enter a positive number: ");
hoursWorked = input.nextFloat();
}
if (hoursWorked > 40){
overtimeHours=hoursWorked - regHours;
employeeBaseSalary = hourlyRate * regHours; //Calculates base salary
System.out.println("Employee base salary is: "+nf.format(employeeBaseSalary)); //Format currency
System.out.print("Overtime hours: " + overtimeHours);
overtimePay = (float) (overtimeHours * 1.5 * hourlyRate);//Calculates overtime pay
System.out.println("\nEmployee's overtime pay: "+nf.format( overtimePay));
employeeWeeklySalary =( employeeBaseSalary + overtimePay);
System.out.println("Employee weekly salary: "+nf.format(employeeWeeklySalary));
//This ends the while loop
if( isName =false){
System.out.println("Thank you for using the Employee Payroll Program");
//Exit message
}
}
}}}}
//End of main method