此代码重复,重复和循环不良-为什么?

时间:2018-10-20 21:07:55

标签: java

这是一门法语课,所以您可能听不懂某些单词,但这并不重要。我现在将翻译一些内容。另外,本次会议我们不使用扫描仪,因为我们是新手,他们开发了一种叫做“键盘(法语为Clavier)”的东西来接受输入。此代码有什么问题?它是披萨饼。

System.out.println("Hi this is a program to take the clients order");
       do { 
                System.out.println("do you want to produce a new bill ? (Y or y = YES, N or n = NO)");
                answer = Keyboard.readChar();
                while (answer != SMALL_Y && answer!= BIG_Y && answer!= SMALL_N && answer!= BIG_N){
                    System.out.println("*** INVALID ANSWER"); 
                    System.out.println("do you want to produce a new bill ? (Y ou y = YES, N ou n = NO)");
                    answer= Keyboard.readChar() ;
                }
                    if (answer == SMALL_Y || answer == BIG_Y ){
                        nbFacture = nbFacture + 1; //thats for the bill number
                        System.out.println ("What is the client phone number?");
                        numTel = Keyboard.readString() ;
                        System.out.println ("What is the client Adress?");
                        adresseLivraison = Keyboard.readString() ;
                        System.out.println ("How many meals between 1 and 4 do you plan to order) ");
                        menu = Keyboard.readInt() ; 


                    } 



        }while(answer != BIG_N|| answer!= SMALL_N); 

我用英语翻译了所有内容,以便您能充分了解所有内容。 键盘功能与扫描仪相同,用于接收输入。

编辑,当我运行此代码时,选择“是”。我同时收到这2个SOP:客户电话号码是多少?  客户地址是什么?

当我选择“否”时,我得到了: 您想产生一张新账单吗? (Y或y =是,N或n =否) ***无效的答案 您想产生一张新账单吗? (Y或y =是,N或n =否)

0 个答案:

没有答案