Repaired code

    private int real;
    private int imaginary;

    public Complex(int real, int imaginary) {
        this.real = real;
        this.imaginary = imaginary;
    }

    public Complex add(Complex z) {
        return new Complex(this.real+z.real, this.imaginary + z.imaginary);
    }

    public long getRealPart() {
        return this.real;
    }

    public long getImaginaryPart() {
        return this.imaginary;
    }

Previous | Next | Top | Cafe con Leche

Copyright 2005, 2006 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified May 10, 2005