Commit 40867e73 authored by Elijah's avatar Elijah

commit

parent b63a1eab
No preview for this file type
// work out here
public class Complex {
public double real;
......@@ -27,25 +26,24 @@ public class Complex {
{
return real;
}
public double magnitude() // magnitude = sqrt(a^2 + b^2)
// work out here
public double magnitude() // problem 1 magnitude = sqrt(a^2 + b^2)
{
Math.sqrt(Math.pow(this.real,2) + Math.pow(this.imag,2));
return 1.0;
return Math.sqrt(Math.pow(real, 2) + Math.pow(imag, 2));
}
public double argument() // argument = tan-1(b/a)
public double argument() // problem 2 argument = tan-1(b/a)
{
//Math.atan2(b,a);
return 1.0;
return Math.atan2(imag,real);
}
public String toString()
public String toString() // problem 3 format = a + jb
{
return "";
// employ if statement?
return real + " + " + "j" + imag;
}
public Complex add(Complex complexNum)
public Complex add(Complex complexNum) // problem 4 addition (a + c) + j(b + d)
{
Complex answer = new Complex(0.0,0.0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment