示例#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);
        }
示例#2
0
文件: Menu.cs 项目: volhadl/AQA-tasks
        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);
        }