Пример #1
0
 public override void Add(Ring obj)
 {
     if (CheckEquality(obj))
     {
         String[] param = obj.GetParameters();
         real += Double.Parse(param[0]);
         imag += Double.Parse(param[1]);
     }
     else
     {
         throw new Exception(message: "Objects are different");
     }
 }
Пример #2
0
 public override void Multiply(Ring obj)
 {
     if (CheckEquality(obj))
     {
         String[] param   = obj.GetParameters();
         double   pReal   = Double.Parse(param[0]);
         double   pImag   = Double.Parse(param[1]);
         double   newReal = (real * pReal - imag * pImag);
         double   newImag = (real * pImag + pReal * imag);
         real = newReal;
         imag = newImag;
     }
     else
     {
         throw new Exception(message: "Objects are different");
     }
 }