public class Complex
extends java.lang.Object
Constructor and Description |
---|
Complex(double r,
double i)
Constructor that initializes the values.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Complex cvalue)
Define a complex add method.
|
static Complex |
add(Complex cvalue1,
Complex cvalue2)
Define a static add method that creates a
a new Complex object with the sum.
|
void |
divide(Complex cvalue)
Divide this complex object by the complex argument.
|
static Complex |
divide(Complex cvalue1,
Complex cvalue2)
Define a static divide method that creates a
a new Complex object with the result of
cvalue1/cvalue2.
|
boolean |
equals(java.lang.Object obj)
Check for the equality of this object with that of the argument.
|
double |
getImg()
Get method for imaginary part.
|
double |
getReal()
Get method for real part.
|
int |
hashCode()
Returns a hash code value for the object.
|
double |
modulus()
Provide the magnitude of the complex value.
|
void |
multiply(Complex cvalue)
Multiply this complex object by the complex argument.
|
static Complex |
multiply(Complex cvalue1,
Complex cvalue2)
Define a static multiply method that creates a
a new Complex object with the product.
|
void |
subtract(Complex cvalue)
Define a complex subtract method.
|
static Complex |
subtract(Complex cvalue1,
Complex cvalue2)
Define a static subtract method that creates a
a new Complex object equal to
cvalue1 - cvalue2.
|
java.lang.String |
toString()
Return a string representation of the complex value.
|
public Complex(double r, double i)
public double getReal()
public double getImg()
public void add(Complex cvalue)
public void subtract(Complex cvalue)
public static Complex add(Complex cvalue1, Complex cvalue2)
public static Complex subtract(Complex cvalue1, Complex cvalue2)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public double modulus()
public void multiply(Complex cvalue)
public static Complex multiply(Complex cvalue1, Complex cvalue2)
public void divide(Complex cvalue)
public static Complex divide(Complex cvalue1, Complex cvalue2)
public java.lang.String toString()
toString
in class java.lang.Object