Skip to content

Commit

Permalink
Update ComplexNumber.java
Browse files Browse the repository at this point in the history
  • Loading branch information
MaguetteD authored Oct 10, 2024
1 parent f24b038 commit 9f42ae1
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,28 +80,29 @@ public void add(ComplexNumber z)
* @param z the complex number to be subtracted from the current complex number
*/

/*public void subtract(ComplexNumber z)
public void subtract(ComplexNumber z)
{
set(subtract(this,z));
}*/
}

/**
* Multiplies another <code>ComplexNumber</code> to the current complex number.
* @param z the complex number to be multiplied to the current complex number
*/

/*public void multiply(ComplexNumber z)
public void multiply(ComplexNumber z)
{
set(multiply(this,z));
}*/
}

/**
* Divides the current <code>ComplexNumber</code> by another <code>ComplexNumber</code>.
* @param z the divisor
*/
/*public void divide(ComplexNumber z)
public void divide(ComplexNumber z)
{
set(divide(this,z));
}*/
}

/**
* Sets the value of current complex number to the passed complex number.
* @param z the complex number
Expand All @@ -128,10 +129,11 @@ public static ComplexNumber add(ComplexNumber z1, ComplexNumber z2)
* @param z2 the second <code>ComplexNumber</code>.
* @return the resultant <code>ComplexNumber</code> (z1 - z2).
*/
/*public static ComplexNumber subtract(ComplexNumber z1, ComplexNumber z2)
public static ComplexNumber subtract(ComplexNumber z1, ComplexNumber z2)
{
return new ComplexNumber(z1.real - z2.real, z1.imaginary - z2.imaginary);
}*/
}

/**
* Multiplies one <code>ComplexNumber</code> to another.
* @param z1 the first <code>ComplexNumber</code>.
Expand Down Expand Up @@ -181,13 +183,13 @@ public double mod()
* The square of the current complex number.
* @return a <code>ComplexNumber</code> which is the square of the current complex number.
*/

/*public ComplexNumber square()
public ComplexNumber square()
{
double _real = this.real*this.real - this.imaginary*this.imaginary;
double _imaginary = 2*this.real*this.imaginary;
return new ComplexNumber(_real,_imaginary);
}*/
}

/**
* @return the complex number in x + yi format
*/
Expand Down Expand Up @@ -406,4 +408,4 @@ else if(format_id == RCIS)
}
return out;
}
}
}

0 comments on commit 9f42ae1

Please sign in to comment.