Exemplo n.º 1
0
        private void Calculate(string op)
        {
            double input_1 = Double.Parse(textBox_Input.Text);
            double input_2 = Double.Parse(textBox_Input_1.Text);

            double results = 0;

            switch (op)
            {
            case "Add":
                results = mathCore.Add(input_1, input_2);
                break;

            case "Subtract":
                results = mathCore.Subtract(input_1, input_2);
                break;

            case "Multiply":
                results = mathCore.Multiply(input_1, input_2);
                break;

            case "Divide":
                results = mathCore.Divide(input_1, input_2);
                break;

            case "Power":
                results = mathCore.Power(input_1, input_2);
                break;

            case "Modulus":
                results = mathCore.Modulus(input_1, input_2);
                break;
            }

            textBox_results.Text = results.ToString("G5");
        }
Exemplo n.º 2
0
        private void Calculate(Operation op)
        {
            double input_1 = Double.Parse(textBox_input_1.Text);
            double input_2 = Double.Parse(textBox_input_2.Text);

            double results = 0;

            switch (op)
            {
            case Operation.ADD:
                results = mathCore.Add(input_1, input_2);
                break;

            case Operation.SUBTRACT:
                results = mathCore.Subtract(input_1, input_2);
                break;

            case Operation.MULTIPLY:
                results = mathCore.Multiply(input_1, input_2);
                break;

            case Operation.DIVIDE:
                results = mathCore.Divide(input_1, input_2);
                break;

            case Operation.POWER:
                results = mathCore.Power(input_1, input_2);
                break;

            case Operation.MODULUS:
                results = mathCore.Modulus(input_1, input_2);
                break;
            }

            textBox_results.Text = results.ToString("G5");
        }