为什么我不能在最后显示消息对话框?
Why can't I get a message dialog to show at end?
我似乎无法在最后显示消息对话框。该程序运行没有错误,要求输入然后什么都没有,就好像它忽略了我的 if 语句。有什么线索吗?
input=JOptionPane.showInputDialog("Enter Internet package choice(A,B, or C):");
hours=JOptionPane.showInputDialog("Enter number of hours used:");
rate=Integer.parseInt(hours);
if(input.equals(a)){
if(rate>10){
optionA=(rate-10) * 2.00 +9.95;
JOptionPane.showMessageDialog(null,"The total is $ " + optionA);}
else if(rate<=10){
JOptionPane.showMessageDialog(null,"The total is $ " + 9.95);
一切都已初始化并声明,所以我对此感到困惑。
input.equals(a) 必须返回 false。在调试器中单步执行并查看
我似乎无法在最后显示消息对话框。该程序运行没有错误,要求输入然后什么都没有,就好像它忽略了我的 if 语句。有什么线索吗?
input=JOptionPane.showInputDialog("Enter Internet package choice(A,B, or C):");
hours=JOptionPane.showInputDialog("Enter number of hours used:");
rate=Integer.parseInt(hours);
if(input.equals(a)){
if(rate>10){
optionA=(rate-10) * 2.00 +9.95;
JOptionPane.showMessageDialog(null,"The total is $ " + optionA);}
else if(rate<=10){
JOptionPane.showMessageDialog(null,"The total is $ " + 9.95);
一切都已初始化并声明,所以我对此感到困惑。
input.equals(a) 必须返回 false。在调试器中单步执行并查看