Ejemplo n.º 1
0
        private BaseOperation OperationType(string operation)
        {
            BaseOperation resultOperation = null;

            switch (operation)
            {
            case ("+"):
                resultOperation = new Add();
                break;

            case ("-"):
                resultOperation = new Subtract();
                break;

            case ("*"):
                resultOperation = new Multiply();
                break;

            case ("/"):
                resultOperation = new Divide();
                break;

            case ("b"):
                resultOperation = new BMI();
                break;

            case ("m"):
                resultOperation = new MatrixMultiply();
                break;

            default:
                throw new InvalidInputException("Operation you entered is not recognized. Please, try again");
            }
            return(resultOperation);
        }
Ejemplo n.º 2
0
        private BaseOperation OperationType(string operation)
        {
            BaseOperation resultOperation = null;

            switch (operation)
            {
            case ("+"):
                resultOperation = new Add();
                break;

            case ("-"):
                resultOperation = new Subtract();
                break;

            case ("*"):
                resultOperation = new Multiply();
                break;

            case ("/"):
                resultOperation = new Divide();
                break;

            case ("b"):
                resultOperation = new BMI();
                break;

            case ("m"):
                resultOperation = new MatrixMultiply();
                break;
            }
            return(resultOperation);
        }