A complex number has a real part and an imaginary part and is represented as real-part + imaginary-part x i, where i is . When writing a complex number, however, you omit the multiplication operator....


A complex number has a real part and an imaginary part and is represented as


real-part + imaginary-part x i, where i is .


When writing a complex number, however, you omit the multiplication operator. For example, 2.5 + 6.2i is a complex number.


To add two complex numbers, you add the two real parts together and separately add the two complex parts together. The two sums make up the real and imaginary parts of the result of the addition. Likewise, to subtract two complex numbers, you subtract one real part from the other and separately subtract one complex part from the other. The two differences make up the real and imaginary parts of the result of the subtraction. Design and implement a class Complex that represents complex numbers. In addition to defining at least two constructors, define the following methods:


• Complex add(Complex number)—Returns the sum of the receiving object and number without  changing either of the operands


• Complex subtract(Complex number)—Returns the difference obtained by subtracting number from  the receiving object without changing either of the operands


• boolean equals(Complex number)—Returns either true or false according to whether the receiving  object and number are equal


• String toString()—Returns a string that represents the receiving object



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here