⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inputcheak.java

📁 一个JAVA源程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                    "For more information please visit:" + "\n" +                    "http://java.sun.com" +"\n\n" +                    "Program TERMINATE" + "\n");                                        System.exit(0);                }  //end of if()                                if(strWhatKindofOption.equals("1")) {                    intErrorInputRecord=5; //quit loop method: while(intErrorInputRecord < 3)                    //by giving value 5(>3) to variable intErrorInputRecord = 5                    boolUserWantMoreCalculation = true;  //quit loop method: while()                    //by giving "true" to boolean variable boolUserNeedThisLogicGate                }  //end of if()                                if(strWhatKindofOption.equals("5")) {                                        intErrorInputRecord=5; //quit loop method: while(intErrorInputRecord < 3)                    //by giving value 5(>3) to variable intErrorInputRecord = 5                    //but NOT quit loop method: while(!(boolUserNeedThisLogicGate))                    //because boolean variable boolUserNeedThisLogicGate is STILL false                    //the loop method: while(!(boolUserNeedThisLogicGate)) is STILL RUNING                }  //end of if()                                if (intErrorInputRecord == 3) {                    JOptionPane.showMessageDialog(null,                    "You input wrong figure for 3 times!" +"\n\n" +                    "Thank you for use this program!"+ "\n\n" +                    "Program provided by: Mr ZHU Xing Jin" +"\n" +                    "Student of University of Center Lancashire" + "\n" +                    "Program based on: JAVA Technology" + "\n\n" +                    "JAVA is a registered Trade Mark of Sun Micorsystems" + "\n" +                    "For more information please visit:" + "\n" +                    "http://java.sun.com" +"\n\n" +                    "Program TERMINATE" + "\n");                    System.exit(0);                }  //end of if()                            }  //end of while(intErrorInputRecord < 3)                    }  //end of loop method: while (!(boolUserNeedThisOption))            } // end of UserOptionCheak()        public void UserLogicGateCheak() {                boolUserNeedThisLogicGate = false;                while (!(boolUserNeedThisLogicGate)) {                        intErrorInputRecord=0; //reset variable intErrorInputRecord = 0                        while (intErrorInputRecord < 3) {                JOptionPane.showMessageDialog(null, "What kind of logic calculation do you need?"+ "\n\n" +                "1 = AND  logic calculation" + "\n" +                "2 = OR   logic calculation" + "\n" +                "3 = NOT  logic calculation" + "\n" +                "4 = XOR  logic calculation" + "\n\n" +                "0 = Exit" + "\n" );                System.out.println("What kind of logic calculation do you need?"+ "\n\n" +                "1 = AND  logic calculation" + "\n" +                "2 = OR   logic calculation" + "\n" +                "3 = NOT  logic calculation" + "\n" +                "4 = XOR  logic calculation" + "\n\n" +                "0 = Exit" + "\n" );                                InputData userInput = new InputData(); //get user input and save input string to strWhatKindofCalculate                strWhatKindofCalculate = userInput.GetKeyboardInput();                                if (!(strWhatKindofCalculate.equals("1")) & !(strWhatKindofCalculate.equals("2")) &                !(strWhatKindofCalculate.equals("3")) & !(strWhatKindofCalculate.equals("4")) &                !(strWhatKindofCalculate.equals("0"))) {                    JOptionPane.showMessageDialog(null, "Your input is: "+ strWhatKindofCalculate + "\n\n" +                    "Please ONLY input SINGLE Figure (NO space):"+ "\n\n" +                    "1 = AND  logic calculation" + "\n" +                    "2 = OR   logic calculation" + "\n" +                    "3 = NOT  logic calculation" + "\n" +                    "4 = XOR  logic calculation" + "\n\n" +                    "0 = Exit" + "\n" );                    System.out.println("Your input is: "+ strWhatKindofCalculate + "\n\n" +                    "Please ONLY input SINGLE Figure (NO space):"+"\n\n" +                    "1 = AND  logic calculation" + "\n" +                    "2 = OR   logic calculation" + "\n" +                    "3 = NOT  logic calculation" + "\n" +                    "4 = XOR  logic calculation" + "\n\n" +                    "0 = Exit" + "\n" );                                        intErrorInputRecord++;  //intErrorInputRecord +1                } //end of if()                                if (strWhatKindofCalculate.equals("0")) {                    JOptionPane.showMessageDialog(null,                    "Thank you for use this program!"+ "\n\n" +                    "Program provided by: Mr ZHU Xing Jin" +"\n" +                    "Student of University of Center Lancashire" + "\n" +                    "Program based on: JAVA Technology" + "\n\n" +                    "JAVA is a registered Trade Mark of Sun Micorsystems" + "\n" +                    "For more information please visit:" + "\n" +                    "http://java.sun.com" +"\n\n" +                    "Program TERMINATE" + "\n");                    System.out.println(                    "Thank you for use this program!"+ "\n\n" +                    "Program provided by: Mr ZHU Xing Jin" +"\n" +                    "Student of University of Center Lancashire" + "\n" +                    "Program based on: JAVA Technology" + "\n\n" +                    "JAVA is a registered Trade Mark of Sun Micorsystems" + "\n" +                    "For more information please visit:" + "\n" +                    "http://java.sun.com" +"\n\n" +                    "Program TERMINATE" + "\n");                                        System.exit(0);  //exit program                } //end of if()                                if (strWhatKindofCalculate.equals("1") | strWhatKindofCalculate.equals("2") |                strWhatKindofCalculate.equals("3")| strWhatKindofCalculate.equals("4")) {                    intErrorInputRecord=5; //quit loop method: while(intErrorInputRecord < 3)                    //by giving value 5(>3) to variable intErrorInputRecord = 5                } //end of if()                                if (intErrorInputRecord == 3) {                    JOptionPane.showMessageDialog(null,                    "You input wrong figure for 3 times!" + "\n\n" +                    "Thank you for use this program!"+ "\n\n" +                    "Program provided by: Mr ZHU Xing Jin" +"\n" +                    "Student of University of Center Lancashire" + "\n" +                    "Program based on: JAVA Technology" + "\n\n" +                    "JAVA is a registered Trade Mark of Sun Micorsystems" + "\n" +                    "For more information please visit:" + "\n" +                    "http://java.sun.com" +"\n\n" +                    "Program TERMINATE" + "\n");                    System.exit(0);                }  //end of if()            }  //end of while(intErrorInputRecord < 3)                        if (strWhatKindofCalculate.equals("1"))            {strUserChoise = "1 = AND Logic Gate";} //end of if()                        if (strWhatKindofCalculate.equals("2"))            {strUserChoise = "2 = OR Logic Gate";}  //end of if()                        if (strWhatKindofCalculate.equals("3"))            {strUserChoise = "3 = NOT Logic Gate";} //end of if()                        if (strWhatKindofCalculate.equals("4"))            {strUserChoise = "4= XOR Logic Gate";}  //end of if()                                    intErrorInputRecord = 0; //reset variable intErrorInputRecord = 0                                    while (intErrorInputRecord < 3) {                JOptionPane.showMessageDialog(null, "You have chosen the following Logic Gate: "+ "\n" +                strUserChoise + "\n\n" +                "Is it what you want? Please Confirm by choosing the following options" + "\n" +                "Please input SINGLE Figure (NO space):"+ "\n\n" +                "1 = YES, Its what i want" + "\n" +                "5 = NO, Its NOT what i want, i wanna CHOOSE AGAIN" + "\n\n" +                "0 = Exit program"+ "\n");                System.out.println("You have chosen the following Logic Gate: "+ "\n" +                strUserChoise + "\n\n" +                "Is it what you want? Please Confirm by choosing the following options" + "\n" +                "Please input SINGLE Figure (NO space):"+ "\n\n" +                "1 = YES, Its what i want" + "\n" +                "5 = NO, Its NOT what i want, i wanna CHOOSE AGAIN" + "\n\n" +                "0 = Exit program"+ "\n");                                InputData userInput = new InputData(); //get user input and save input string to strWhatKindofCalculate                strWhatKindofOption = userInput.GetKeyboardInput();                                if (!(strWhatKindofOption.equals("0")) & !(strWhatKindofOption.equals("1")) &                !(strWhatKindofOption.equals("5"))) {                    JOptionPane.showMessageDialog(null, "Your input is: "+ strWhatKindofOption + "\n\n" +                    "Please ONLY input SINGLE Figure (NO space):"+"\n\n" +                    "1 = YES, Its what i want" + "\n" +                    "5 = NO, Its NOT what i want, i wanna CHOOSE AGAIN" + "\n\n" +                    "0 = Exit program"+ "\n");                    System.out.println("Your input is: "+ strWhatKindofOption + "\n\n" +                    "Please ONLY input SINGLE Figure (NO space):"+"\n\n" +                    "1 = YES, Its what i want" + "\n" +                    "5 = NO, Its NOT what i want, i wanna CHOOSE AGAIN" + "\n\n" +                    "0 = Exit program"+ "\n");                                        intErrorInputRecord++;                }  //end of if()                                if (strWhatKindofOption.equals("0")) {                    JOptionPane.showMessageDialog(null,                    "Thank you for use this program!"+ "\n\n" +                    "Program provided by: Mr ZHU Xing Jin" +"\n" +                    "Student of University of Center Lancashire" + "\n" +                    "Program based on: JAVA Technology" + "\n\n" +                    "JAVA is a registered Trade Mark of Sun Micorsystems" + "\n" +                    "For more information please visit:" + "\n" +                    "http://java.sun.com" +"\n\n" +                    "Program TERMINATE" + "\n");                    System.out.println(                    "Thank you for use this program!"+ "\n\n" +                    "Program provided by: Mr ZHU Xing Jin" +"\n" +                    "Student of University of Center Lancashire" + "\n" +                    "Program based on: JAVA Technology" + "\n\n" +                    "JAVA is a registered Trade Mark of Sun Micorsystems" + "\n" +                    "For more information please visit:" + "\n" +                    "http://java.sun.com" +"\n\n" +                    "Program TERMINATE" + "\n");                                        System.exit(0);                }  //end of if()                                if(strWhatKindofOption.equals("1")) {                    intErrorInputRecord=5; //quit loop method: while(intErrorInputRecord < 3)                    //by giving value 5(>3) to variable intErrorInputRecord = 5                    boolUserNeedThisLogicGate = true;  //quit loop method: while(!(boolUserNeedThisLogicGate))                    //by giving "true" to boolean variable boolUserNeedThisLogicGate                }  //end of if()                                if(strWhatKindofOption.equals("5")) {                    intErrorInputRecord=5; //quit loop method: while(intErrorInputRecord < 3)                    //by giving value 5(>3) to variable intErrorInputRecord = 5                    //but NOT quit loop method: while(!(boolUserNeedThisLogicGate))                    //because boolean variable boolUserNeedThisLogicGate is STILL false                    //the loop method: while(!(boolUserNeedThisLogicGate)) is STILL RUNING                }  //end of if()                                if (intErrorInputRecord == 3) {                    JOptionPane.showMessageDialog(null,                    "You input wrong figure for 3 times!" +"\n\n" +                    "Thank you for use this program!"+ "\n\n" +                    "Program provided by: Mr ZHU Xing Jin" +"\n" +                    "Student of University of Center Lancashire" + "\n" +                    "Program based on: JAVA Technology" + "\n\n" +                    "JAVA is a registered Trade Mark of Sun Micorsystems" + "\n" +                    "For more information please visit:" + "\n" +                    "http://java.sun.com" +"\n\n" +                    "Program TERMINATE" + "\n");                    System.exit(0);                }  //end of if()                            }  //end of while(intErrorInputRecord < 3)                    } //end of loop method: while (!(boolUserNeedThisLogicGate))            }  //end of UserLogicGateCheak()        public String GetstrWhatKindofCalculate(){        return strWhatKindofCalculate;    }  //end of public String GetstrWhatKindofCalculate()        public String GetstrMoreCalculate(){        return strMoreCalculate;    }  //end of public String GetstrMoreCalculate()    }  //end of class InputCheak

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -