Exemplo n.º 1
0
        public static ComplexNumber operator *(ComplexNumber first, ComplexNumber second)
        {
            ComplexNumber number = new ComplexNumber();

            number.setA(first.getA() * second.getA() - first.getB() * second.getB());
            number.setB(first.getA() * second.getB() + second.getA() * first.getB());

            return(number);
        }
Exemplo n.º 2
0
        public static ComplexNumber operator /(ComplexNumber numerator, ComplexNumber denominator)
        {
            ComplexNumber number = new ComplexNumber();

            double divider = (denominator * getReversal(denominator)).getA();

            number = numerator * getReversal(denominator);
            number.setA(number.getA() / divider);
            number.setB(number.getB() / divider);

            return(number);
        }