0
// 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);
}
}
}
當我運行它運行良好的程序,當它擊中的循環和重複,員工姓名:和薪似乎成一團此外,我將如何得到它馬上。鍵入停止爲員工姓名後停止?工資計劃第2部分(的問題,同時運行
我將打印件更改爲printlns,它仍然出現相同的問題。我很欣賞這個鏈接。 – Usdblades
你可以準確地告訴我你的意思嗎?我可能不會理解這一點。 – Krrose27
當我運行程序,它可以完美運行,然後當它循環, 它scrunches像這樣 員工名稱: 每小時收費: (這是它讓我開始鍵入再次 – Usdblades