Beispiel #1
0
        public static Operation createOperate(string operate)
        {
            Operation oper = null;

            switch (operate)
            {
            case "+":
            {
                oper = new OperationAdd();
                break;
            }

            case "-":
            {
                oper = new OperationSub();
                break;
            }

            case "*":
            {
                oper = new OperationMul();
                break;
            }

            case "/":
            {
                oper = new OperationDiv();
                break;
            }

            case "sqr":
            {
                oper = new OperationSqr();
                break;
            }

            case "sqrt":
            {
                oper = new OperationSqrt();
                break;
            }

            case "+/-":
            {
                oper = new OperationReverse();
                break;
            }
            }

            return(oper);
        }
Beispiel #2
0
        public static Operation createOperate(string operate)
        {
            Operation oper = null;
            switch (operate)
            {
                case "+":
                    {
                        oper = new OperationAdd();
                        break;
                    }
                case "-":
                    {
                        oper = new OperationSub();
                        break;
                    }
                case "*":
                    {
                        oper = new OperationMul();
                        break;
                    }
                case "/":
                    {
                        oper = new OperationDiv();
                        break;
                    }
                case "sqr":
                    {
                        oper = new OperationSqr();
                        break;
                    }
                case "sqrt":
                    {
                        oper = new OperationSqrt();
                        break;
                    }
                case "+/-":
                    {
                        oper = new OperationReverse();
                        break;
                    }
            }

            return oper;
        }