Question: Create a ComplexNumber class to represent a complex number. A complex number is a number that's of the form a+bi, where a and b

Create a ComplexNumber class to represent a complex number. A complex number is a number that's of the form a+bi, where a and b are real numbers (a, b = R), but i -1, also called the imaginary unit. Check Wikipedia if you need a refresher. = The fields for a Complex Number should be a and b,. Create a constructor that initializes values for both a and b. You do not need a variable to represent i, the imaginary unit. Create instance methods add, subtract, multiply, and divide. Each of these methods will take in one other ComplexNumber and performs the stated operation to produce a new ComplexNumber. For example, the add method should look like this: public Complex Number add (Complex Number other) { Demo by creating some complex numbers and testing them out.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
