Question: Create a Complex Number class should have 4 constructors: One that takes two double parameters, a real part and an imaginary part One that takes

Create a Complex Number class should have 4 constructors: One that takes two double parameters, a real part and an imaginary part One that takes one double parameter, the real part (the imaginary part is assumed to be zero) One that takes no parameters, the real and imaginary parts are zero. (As a bonus implement this constructor): One that takes a String such as "3+5i", or "17.5-21.3i", or "3.1416", or "99i" (allow blanks in the string) And these public methods: public Complex add(Complex c) public Complex subtract(Complex c) public Complex multiply(Complex c) public Complex divide(Complex c) public double abs() public Complex negate() public Complex conjugate() public double distance(Complex c) public boolean equals(Complex c) public boolean greaterThan(Complex c) public boolean lessThan(Complex c) public String toString() All numbers should be immutable, that is, there should be no way to change their components after the numbers have been created. Most of your methods simply return a new Complex number.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!