Ejemplo n.º 1
0
 public override IFunction Simplify()
 {
     if (ToRight.GetType() == typeof(Numbers))
     {
         if (ToRight.ToInfix() == "0")
         {
             throw new Exception("Can not divide by zero!");
         }
     }
     if (Toleft.GetType() == typeof(Numbers))
     {
         if (Toleft.ToInfix() == "0")
         {
             return(new Numbers(0));
         }
     }
     return(new DevisionFunction(Toleft, ToRight));
 }
Ejemplo n.º 2
0
 public override IFunction Simplify()
 {
     if (Toleft.GetType() == typeof(Numbers))
     {
         if (Toleft.ToInfix() == "0")
         {
             return(new Numbers(0));
         }
     }
     if (ToRight.GetType() == typeof(Numbers))
     {
         if (ToRight.ToInfix() == "0")
         {
             return(new Numbers(0));
         }
         return(new Multiplication(Toleft, ToRight));
     }
     else
     {
         return(new Multiplication(Toleft, ToRight));
     }
 }
Ejemplo n.º 3
0
        public override string ToInfix()
        {
            string toprefixvalue = Toleft.ToInfix() + ToRight.ToInfix();

            return(toprefixvalue);
        }