// Week 3 Checkpoint1: Payroll Program Part 2
// Due May 04, 2012
// Created by: Kennith Adkins
import java.util.Scanner;
public class Assignment1
 {
    public static void main ( String[] args )
    {
        Scanner input = new Scanner(System.in);
        // Variables
        String employeeName = null;
        int hours;
        double rate;
        double pay;
        while ( employeeName != "stop")
        {
        // Request information from user
        System.out.print ( "Employee Name: ");
        employeeName = input.nextLine();
        System.out.print ( "Hourly Rate: ");
        rate = input.nextDouble();
        System.out.print ( "Number of Hours worked this week: ");
        hours = input.nextInt();
        // Calculate pay
        pay = rate * hours;
        // Display information
        System.out.printf ("%s will get paid $%.2f this week.\n", employeeName, pay);
        }
    }
}
当我运行程序时,它运行良好。当它进入循环并重复时,Employee Name: 和 Hourly Rate 似乎聚集在一起。另外,在输入 stop 作为员工姓名后,我如何让它立即停止?