Example #1
0
        public static Operation CreateFactory(string operation)
        {
            Operation oper = null;

            switch (operation)
            {
            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);
        }
Example #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);
        }
Example #3
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;
 }