ComplexNumber.java I NEED HELPPP
I'm doing programs out of this old java book, I took Computer programming last year at school and used the book but I haven't did the stuff in a while and I'm stuck on a proplem. It says:
Create a class called ComplexNumber that implements complex numbers. The class should have two fields, real and imaginary which hold the real and imaginary parts of the number.
- Create a ComplexNumber object with real and imaginary parts specified by r and i
ComplexNumber (double r, double i)
-Add the complex number represented by c to the ComplexNumber.
void add (ComplexNumber c)
-Multiply the ComplexNumber by the complex number represented by c.
void multiply (ComplexNumber c)
-Return the real portion of the ComplexNumber.
double getReal ()
-Return the imaginary portion of the ComplexNumber.
double getImaginary ()
-Return a String that contains a formatted version of the ComplexNumber.
String formatAsString ()
Create a program called TestComplex that creates two pairs of ComplexNumber objects and outputs them, their sum, and their product.
Any help will be most appreciated.