?? and.java
字號(hào):
import javax.swing.JOptionPane;class And { private static String strMoreCalculate; private static String strWhatKindofCalculate; private static int intUserInputFigure; private static int intResultofLastCalculation; final private static boolean boolUserWantCalculate = true; And(){ //constructor method and() intResultofLastCalculation =0; strMoreCalculate = "5"; } //end of constructor method and() public static void main(String args[]) { And logicGateCalculation = new And(); while (boolUserWantCalculate) { /******************************************************************************************************************* * * ******************************************************************************************************************/ if (Integer.parseInt(strMoreCalculate) == 5) { InputCheak UserStartProgram = new InputCheak(); UserStartProgram. UserStartProgramCheak(); InputCheak UserLogicGateInput = new InputCheak(); UserLogicGateInput.UserLogicGateCheak(); strWhatKindofCalculate = UserLogicGateInput.GetstrWhatKindofCalculate(); switch (Integer.parseInt(strWhatKindofCalculate)) { case 1: LogicGateAnd AndLogicGate = new LogicGateAnd(); intUserInputFigure = AndLogicGate.UserInput(); AndLogicGate.SetintUserInput_1st(intUserInputFigure); intUserInputFigure = AndLogicGate.UserInput(); AndLogicGate.SetintUserInput_2nd(intUserInputFigure); AndLogicGate.Calculate(); intResultofLastCalculation = AndLogicGate.GetintResult(); AndLogicGate.Display(); break; case 2: LogicGateOr OrLogicGate = new LogicGateOr(); intUserInputFigure = OrLogicGate.UserInput(); OrLogicGate.SetintUserInput_1st(intUserInputFigure); intUserInputFigure = OrLogicGate.UserInput(); OrLogicGate.SetintUserInput_2nd(intUserInputFigure); OrLogicGate.Calculate(); intResultofLastCalculation = OrLogicGate.GetintResult(); OrLogicGate.Display(); break; case 3: LogicGateNot NotLogicGate = new LogicGateNot(); intUserInputFigure = NotLogicGate.UserInput(); NotLogicGate.SetintUserInput_1st(intUserInputFigure); NotLogicGate.Calculate(); intResultofLastCalculation = NotLogicGate.GetintResult(); NotLogicGate.Display(); break; case 4: LogicGateXor XorLogicGate = new LogicGateXor(); intUserInputFigure = XorLogicGate.UserInput(); XorLogicGate.SetintUserInput_1st(intUserInputFigure); intUserInputFigure = XorLogicGate.UserInput(); XorLogicGate.SetintUserInput_2nd(intUserInputFigure); XorLogicGate.Calculate(); intResultofLastCalculation = XorLogicGate.GetintResult(); XorLogicGate.Display(); break; } InputCheak UserWantMoreCalculation = new InputCheak(); UserWantMoreCalculation.UserWantMoreCalculationCheak(); strMoreCalculate = UserWantMoreCalculation.GetstrMoreCalculate(); } //end of if (Integer.parseInt(strMoreCalculate) == 5) /******************************************************************************************************************* * * ******************************************************************************************************************/ else if (Integer.parseInt(strMoreCalculate) == 1) { InputCheak UserLogicGateInput = new InputCheak(); UserLogicGateInput.UserLogicGateCheak(); strWhatKindofCalculate = UserLogicGateInput.GetstrWhatKindofCalculate(); switch (Integer.parseInt(strWhatKindofCalculate)) { case 1: LogicGateAnd AndLogicGate = new LogicGateAnd(); intUserInputFigure = AndLogicGate.UserInput(); AndLogicGate.SetintUserInput_1st(intUserInputFigure); AndLogicGate.SetintUserInput_2nd(intResultofLastCalculation); AndLogicGate.Calculate(); AndLogicGate.Display(intResultofLastCalculation); intResultofLastCalculation = AndLogicGate.GetintResult(); break; case 2: LogicGateOr OrLogicGate = new LogicGateOr(); intUserInputFigure = OrLogicGate.UserInput(); OrLogicGate.SetintUserInput_1st(intUserInputFigure); OrLogicGate.SetintUserInput_2nd(intResultofLastCalculation); OrLogicGate.Calculate(); OrLogicGate.Display(intResultofLastCalculation); intResultofLastCalculation = OrLogicGate.GetintResult(); break; case 3: LogicGateNot NotLogicGate = new LogicGateNot(); NotLogicGate.SetintUserInput_2nd(intResultofLastCalculation); NotLogicGate.Calculate(); NotLogicGate.Display(intResultofLastCalculation); intResultofLastCalculation = NotLogicGate.GetintResult(); break; case 4: LogicGateXor XorLogicGate = new LogicGateXor(); intUserInputFigure = XorLogicGate.UserInput(); XorLogicGate.SetintUserInput_1st(intUserInputFigure); XorLogicGate.SetintUserInput_2nd(intResultofLastCalculation); XorLogicGate.Calculate(); XorLogicGate.Display(intResultofLastCalculation); intResultofLastCalculation = XorLogicGate.GetintResult(); break; } InputCheak UserWantMoreCalculation = new InputCheak(); UserWantMoreCalculation.UserWantMoreCalculationCheak(); strMoreCalculate = UserWantMoreCalculation.GetstrMoreCalculate(); } //end of else if (Integer.parseInt(strMoreCalculate) == 1) } // end of loop method: while (boolUserWantCalculate) } //end of main()} //end of class And
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -