Untitled
unknown
plain_text
a year ago
706 B
2
Indexable
Never
class Complejo{ private double real; private double imag; Complejo(){ this(0,0); } Complejo(double real, double imag){ this.real=real; this.imag=imag; } void setReal(double real){ this.real=real; } double getReal(){ return this.real; } void setImag(double imag){ this.imag=imag; } double getImag(){ return imag; } Complejo sumar(Complejo b){ return new Complejo(this.real+b.real, this.imag+b.imag); } public String toString(){ return this.real+ (this.imag>=0?" + "+this.imag+"i": " "+this.imag+"i") ; } }