Tag: complex numbers

使用OOP结构添加和减去复数

我这里有一个代码,应该打印两个复数的和和差。 给出的指示是: 使方法add , subtract和print void 使用构造函数的对象进行测试。 public class Complex { /** * @param args */ public double real; public double imag; public String output = “”; public Complex(double real, double imag){ this.real += real; this.imag += imag; } public Complex(){ real = 0; imag = 0; } public double getReal(){ return real; } public […]