我在验证这部分代码时遇到问题,错误消息显示不正确,如果我只按回车键程序将退出,感谢任何帮助。
strInput1="";
strInput1 = JOptionPane.showInputDialog(null,
"2013 SHIPPING OPTIONS\n\n(O)vernight shipping-$10.00"+
"\n(T)wo-Day shipping-$7.50\n(P)riority shipping-$5.00"+
"\n(N)o cost shipping"+
"\n\nPlease select a shipping option(O,P,T or N) ",
"Wiliam's Party Store",3);
if(!strInput1.equals(""))
JOptionPane.showMessageDialog(null,
"You MUST enter O,o,T,t,P,p,N,n",
"ERROR!!!",0);
cShipping=(strInput1.toUpperCase().charAt(0));
while((!strInput1.equals(""))&& !(cShipping=='P')|(cShipping=='T')||(cShipping=='O'))
{
JOptionPane.showMessageDialog(null,
"You MUST enter O,o,T,t,P,p,N,n",
"ERROR!!!",0);
strInput1 = JOptionPane.showInputDialog(null,
"2013 SHIPPING OPTIONS\n\n(O)vernight shipping-$10.00"+
"\n(T)wo-Day shipping-$7.50\n(P)riority shipping-$5.00"+
"\n(N)o cost shipping"+
"\n\nPlease select a shipping option(O,P,T or N) ",
"Wiliam's Party Store",3);
if (!strInput1.equals(""))
cShipping=(strInput1.toUpperCase().charAt(0));
strInput1 = "N";
}
PO1.setShipping(cShipping);