import javax.swing.JOptionPane;
public class PayCheckStatic
{
public static void main(String[] args)
{
while (name!=null)
{
String name = JOptionPane.showInputDialog("Please enter the next employees name" );
String wage = JOptionPane.showInputDialog("Please enter their hourly wage?");
String hoursWorked = JOptionPane.showInputDialog ("How many hours did they work this last work?");
double wages = Double.parseDouble(wage);
double hours = Double.parseDouble(hoursWorked);
calculatePay(name,wages,hours);
}
}
private static void calculatePay(String name,double wages,double hours)
{
if (hours > 40)
{
double pay = ((wages * 40)+((hours - 40)*(1.5 * wages)));
JOptionPane.ShowMessageDialog (null,name + "'s pay is £" + pay);
}
else
{
double pay = (wages * hours);
JOptionPane.ShowMessageDialog (null,name + "'s pay is £" + pay);
}
}
}
由于某种原因,我的代码无法编译,并且出现了找不到符号错误,我不知道为什么。该错误显示 3 次,其中 2 次出现在消息对话框中。关于如何修复它的任何提示?