My instructions were to make a no-argument constructor with default values.
I am having difficulty setting up proper constructors to initialize my class variables re
and im
. I tried to create a default constructor and use it, but I have a number of errors indicating that I am not doing it correctly.
public class Complex {
// Constants (final)
protected double re; // the real part
protected double imag; // the imaginaryinary part
// Variables
public double product;
public Complex() {}
// create a new object with the given real and imaginaryinary parts
Complex() {
this.re = real;
imag = imaginary;
}
....... Code goes on
I think, most of my problems is that I have to do with my constructor and lack of this
.
// create a new object with the given real and imaginaryinary parts
Complex() {
this.re = 1.0;
this.imag = 2.0;
}