Beispiel #1
0
 public void Reset()
 {
     operation = Operation.None;
     function1 = Function.None;
     function2 = Function.None;
     Lop_Res   = new Calc_Number(0, 10, 1);
     Rop       = new Calc_Number(0, 10, 1);
 }
Beispiel #2
0
        public Calc_Number Multiply(Calc_Number Num2)
        {
            if (b != Num2.b)
            {
                throw new Exception("С.C. не совпадают");
            }
            Calc_Number Num3 = new Calc_Number(Math.Round(a * Num2.a, c), b, c);

            return(Num3);
        }
Beispiel #3
0
        public Calc_Number Inverse()
        {
            if (a == 0)
            {
                throw new Exception("Деление на ноль");
            }
            Calc_Number Num3 = new Calc_Number(Math.Round(1 / a, c), b, c);

            return(Num3);
        }
Beispiel #4
0
        public void CommitDigit()
        {
            Calc_Number target = leftFocus ? processor.Lop_Res : processor.Rop;

            target.a = Calc_Conver_p_10.Do(editor.number, pIn, acuracy);
            target.b = pIn;
            target.c = acuracy;

            editor.operation = "";
            editor.function  = "";

            leftFocus = false;
        }
Beispiel #5
0
        public Calc_Number Devide(Calc_Number Num2)
        {
            if (b != Num2.b)
            {
                throw new Exception("С.C. не совпадают");
            }
            if (Num2.a == 0)
            {
                throw new Exception("Деление на ноль");
            }
            Calc_Number Num3 = new Calc_Number(Math.Round(a / Num2.a, c), b, c);

            return(Num3);
        }
Beispiel #6
0
        public void FunctionRun()
        {
            switch (function1)
            {
            case Function.Sqrt:
                Lop_Res = Lop_Res.Squared();
                break;

            case Function.Rev:
                Lop_Res = Lop_Res.Inverse();
                break;
            }
            switch (function2)
            {
            case Function.Sqrt:
                Rop = Rop.Squared();
                break;

            case Function.Rev:
                Rop = Rop.Inverse();
                break;
            }
        }
Beispiel #7
0
        public void OperationRun()
        {
            switch (operation)
            {
            case Operation.None:
                break;

            case Operation.Add:
                Lop_Res = Lop_Res.Sum(Rop);
                break;

            case Operation.Sub:
                Lop_Res = Lop_Res.Substract(Rop);
                break;

            case Operation.Mul:
                Lop_Res = Lop_Res.Multiply(Rop);
                break;

            case Operation.Dvd:
                Lop_Res = Lop_Res.Devide(Rop);
                break;
            }
        }
Beispiel #8
0
        public Calc_Number Copy()
        {
            Calc_Number n = new Calc_Number(a, b, c);

            return(n);
        }
Beispiel #9
0
        public Calc_Number Squared()
        {
            Calc_Number Num3 = new Calc_Number(Math.Round(Math.Pow(a, 2), c), b, c);

            return(Num3);
        }
Beispiel #10
0
 public void SetLopCopy(Calc_Number E)
 {
     Lop_Res = E.Copy();
 }
Beispiel #11
0
 public void SetRopCopy(Calc_Number E)
 {
     Rop = E.Copy();
 }