我是java编程新手。如果用户输入错误,我希望程序再次请求输入。我该怎么办?请帮帮我!如果你想避免混乱,就跳到“如果”部分。。。不要粗鲁,但如果你不能回答,请不要要求结束问题。
case 'A': case 'a':
System.out.println("You selected NOS Tank.");
int price;
double quantity;
double variant=0;
System.out.println("Select the variant: ");
System.out.println("Enter 'D' without apostrophe for dry or 'W' for wet");
variant=xss.next().charAt(0);
if (variant=='D' || variant=='d')
{
System.out.println("The price of dry nitrous oxide system is: $600");
}
else if (variant=='w' || variant=='W')
{
System.out.println("The price of wet nitrous oxide is: $740");
}
else
{
System.out.println("Invalid input.");
}
暂无答案!
目前还没有任何答案,快来回答吧!