예제 #1
0
 public override CalculationResult Substract(StringResult second)
 {
     if (string.IsNullOrEmpty(second.Value))
     {
         return(this);
     }
     throw new Exception("Can`t substract Number and String.");
 }
예제 #2
0
 public override BoolResult IsLess(StringResult second)
 {
     if (string.IsNullOrEmpty(this.Value))
     {
         return(new BoolResult(false));
     }
     return(new BoolResult(string.Compare(this.Value, second.Value) == -1));
 }
예제 #3
0
 public override BoolResult IsLess(StringResult second)
 {
     if (string.IsNullOrEmpty(second.Value))
     {
         return(new BoolResult(true));
     }
     return(new BoolResult(true));
 }
예제 #4
0
 public override CalculationResult Multiply(StringResult second)
 {
     if (int.TryParse(this.Value, out var res))
     {
         return(new StringResult(string.Join("", Enumerable.Repeat(second.Value, res))));
     }
     else
     {
         throw new Exception("Cant multiply number and string.");
     }
 }
예제 #5
0
 public abstract BoolResult IsLess(StringResult second);
예제 #6
0
 public abstract BoolResult IsBigger(StringResult second);
예제 #7
0
 public abstract CalculationResult Divide(StringResult second);
예제 #8
0
 public abstract CalculationResult Multiply(StringResult second);
예제 #9
0
 public abstract CalculationResult Substract(StringResult second);
예제 #10
0
 public override CalculationResult Multiply(StringResult second)
 {
     throw new Exception("Can`t multiply strings.");
 }
예제 #11
0
 public override CalculationResult Substract(StringResult second)
 {
     throw new Exception("Can`t substract Strings.");
 }
예제 #12
0
 public override CalculationResult Add(StringResult second)
 {
     return(new StringResult(this.Value + second.Value));
 }
예제 #13
0
 public override CalculationResult Divide(StringResult second)
 {
     throw new Exception("Can`t divide strings.");
 }
예제 #14
0
        public override CalculationResult Divide(StringResult second)
        {
            return(new NumberResult(0));

            throw new Exception("Can`t divide strings.");
        }