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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started