Create a class called Complex for performing arithmetic with complex numbers.
Complex numbers have the form
realPart + imaginaryPart * i (e.g., a + bi)
where i is : square root(1)
The class should contain:
- Two double data fields x and y that represent the real and imaginary part of a complex number.
- A no-arg constructor that creates a complex number (0 + 0i).
- A constructor that creates a Complex object with specified real and imaginary part of the complex number.
- Two get methods for data fields x and y, respectively.
- A method named add that returns the addition of this complex number with another. Complex numbers are added by adding the real and
imaginary parts of the summands. That is to say:
(a+bi) + (c+di) = (a+c) + (b+d)i
The method is: public Complex add(Complex c) {}- A method named subtract that returns the subtraction of this complex
number with another. Subtraction is defined by:
(a+bi) + (c+di) = (a-c) + (b-d)i
The method is: public Complex subtract(Complex c) {}- A method named multiply that returns the multiplication of this complex
with another. The multiplication of two complex numbers is defined by
the following formula:
( a+bi )( c+di ) = ( ac – bd ) + ( bc + ad )i
The method is: public Complex multiply(Complex c) {}- AtoString() method that prints a Complex object in the form (a)+(b)i, where a is the real part and b is the imaginary part.
I don't even know how to do this is in math class, yet alone java, can someone point me in the right direction?