Beispiel #1
0
 public string Division(string firstElement, string secondElement)
 {
     if (DataProcessing.TypeCheck(firstElement, secondElement))
     {
         double firstNumber  = double.Parse(firstElement);
         double secondNumber = double.Parse(secondElement);
         double result       = firstNumber / secondNumber;
         return(result.ToString());
     }
     else
     {
         return("Operator \'/\' cannot be applied to operands of type \'string\' and \'string\'");
     }
 }
Beispiel #2
0
        //public void Addition(string a, string b)
        //{
        //    bool BoolItem1FirstElement = DataProcessing.TypeCheck(a).Item1;
        //    bool BoolItem2FirstElement = DataProcessing.TypeCheck(a).Item2;
        //    bool BoolItem1SecondElement = DataProcessing.TypeCheck(b).Item1;
        //    bool BoolItem2SecondElement = DataProcessing.TypeCheck(b).Item2;
        //    if (!BoolItem1FirstElement || !BoolItem2FirstElement || !BoolItem1SecondElement || !BoolItem2SecondElement)
        //    {

        //    }
        //}
        public string Addition(string firstElement, string secondElement)
        {
            if (!DataProcessing.TypeCheck(firstElement, secondElement))
            {
                return(firstElement + secondElement);
            }
            else
            {
                double firstNumber  = double.Parse(firstElement);
                double secondNumber = double.Parse(secondElement);
                double result       = firstNumber + secondNumber;
                return(result.ToString());
            }
        }