我似乎无法在结尾处显示消息对话框。程序运行时没有错误,要求输入,然后什么也不需要,就好像它忽略了我的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);一切都是初始化和声明的,所以我对此感到困惑。
发布于 2016-03-25 19:44:59
input.equals(a)必须返回false。在调试器中逐步遍历它,然后查看
https://stackoverflow.com/questions/36226839
复制相似问题