hi;
I am trying to create a program that will return information stored as long as the word stop is not entered for the employee name, I cant get the program to work can some one help me with this. this what I have so far.
// payroll program upgrade
import java.util.Scanner; // program uses scanner
public class payroll5
{
public static void main( String args[] )
{
Scanner input = new Scanner(System.in );
String nameOfEmployee;
double rateOfPay;
rateOfPay = 0;
double hours;
double sum;
System.out.println( "Please enter name of employee or stop to quit: " );
nameOfEmployee = input.nextLine();
while (!nameOfEmployee.equalsIgnoreCase(stop))
{
System.out.println( " enter employee name " );
nameOfEmployee = input.nextLine();
System.out.println( " Enter rate of pay: $ " );
rateOfPay = input.nextDouble();
while ( rateOfPay <= 0 )
{
System.out.println( " must enter a positive number: $ " );
rateOfPay = input.nextDouble();
}
System.out.println( "Enter Hours: " );
hours = input.nextDouble();
while ( hours <= 0 )
{
System.out.println( " hours must be a positive number" );
hours = input.nextDouble();
}
sum = rateOfPay * hours;
System.out.print(nameOfEmployee);
System.out.printf( " 's weekly pay is : $%f\n", sum );
System.out.println( "Enter employee name or stop to quit: " );
nameOfEmployee = "";
while (!nameOfEmployee.equalsIgnoreCase())
{
nameOfEmployee = input.nextLine();
}
System.out.println( "End Program" );
}
}
}