Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Loops 如何使我的GUI多次出现并获取该输入_Loops_If Statement_User Interface - Fatal编程技术网

Loops 如何使我的GUI多次出现并获取该输入

Loops 如何使我的GUI多次出现并获取该输入,loops,if-statement,user-interface,Loops,If Statement,User Interface,嗨,我是编程新手,我需要做一个程序来回答这个问题,我现在被这个问题困住了 提示用户使用数字1、2或3从菜单中选择与其首选的成员资格或额外选项相对应的项目,否则用户输入0退出。 如果用户选择1,则再次显示输入框;如果用户选择0,则显示所选成员资格的成本。 如果用户在输入0之前从菜单中选择了附加,则添加附加的价格并向用户显示。 如果用户选择全部三项,则添加三项并向用户显示成本 我不明白如何让gui出现一次又一次,并且仍然接受输入 在线包装应用 导入javax.swing.JOptionPane; 公

嗨,我是编程新手,我需要做一个程序来回答这个问题,我现在被这个问题困住了

提示用户使用数字1、2或3从菜单中选择与其首选的成员资格或额外选项相对应的项目,否则用户输入0退出。 如果用户选择1,则再次显示输入框;如果用户选择0,则显示所选成员资格的成本。 如果用户在输入0之前从菜单中选择了附加,则添加附加的价格并向用户显示。 如果用户选择全部三项,则添加三项并向用户显示成本

我不明白如何让gui出现一次又一次,并且仍然接受输入

在线包装应用

导入javax.swing.JOptionPane; 公共类在线应用程序{

public static void main(String[] args) {
 String result;
  int one=350;
  int two=450;
  int three=550;
 int input;
   String calculations;       
   
  
   result =   JOptionPane.showInputDialog(null,"(1)Basic membership     "+one+" \n(2)Specials          "+two+"\n (3)VIP treatment      "+three+"  \nmake selection.Press 0 to quit",JOptionPane.INFORMATION_MESSAGE);     

  
   input= Integer. parseInt(result);
   
   
 
   
   if(input==1 && input ==0)JOptionPane.showMessageDialog(null, "Your total cost comes to "+one); 
   if(input==2 && input ==0)JOptionPane.showMessageDialog(null, "Your total cost comes to "+two);
   if(input==3 && input ==0)JOptionPane.showMessageDialog(null, "Your total cost comes to "+three);
   
   if(input==1 && input==2 && input==0)   JOptionPane.showMessageDialog(null, "Your total cost comes to 800"+one+two); 
   if(input==1 && input==3 && input==0)   JOptionPane.showMessageDialog(null, "Your total cost comes to 800"+one+three); 
   if(input==2 && input==3 && input==0)   JOptionPane.showMessageDialog(null, "Your total cost comes to 800"+three+two); 
   
   if(input==1 && input==2 && input==3 )JOptionPane.showMessageDialog(null, "Your total cost comes to 1350");

 
    }

  }