Exemple #1
0
        public void MathOperation()
        {
            switch (opType)
            {
            case OpType.Sum:
                if (fraction2.Denominator != 1)
                {
                    fraction1.Sum(fraction2);
                }
                else
                {
                    fraction1.Sum(fraction2.Numerator);
                }
                break;

            case OpType.Subtraction:
                if (fraction2.Denominator != 1)
                {
                    fraction1.Subtraction(fraction2);
                }
                else
                {
                    fraction1.Subtraction(fraction2.Numerator);
                }
                break;

            case OpType.Multiplication:
                if (fraction2.Denominator != 1)
                {
                    fraction1.Multiplication(fraction2);
                }
                else
                {
                    fraction1.Multiplication(fraction2.Numerator);
                }
                break;

            case OpType.Dividing:
                if (fraction2.Denominator != 1)
                {
                    fraction1.Dividing(fraction2);
                }
                else
                {
                    fraction1.Dividing(fraction2.Numerator);
                }
                break;
            }
        }