public class Complex_cartesian { private double a; private double b; private Complex_cartesian(double a, double b) { this.a = a; this.b = b; } public static Complex_cartesian Create_from_cartesian(double a, double b) { return new Complex_cartesian(a, b); } public static Complex_cartesian Create_from_polar(double r, double theta) { return new Complex_cartesian(r * Math.cos(theta), r * Math.sin(theta)); } public double getA() { return a; } public double getB() { return b; } public Complex_cartesian add(Complex_cartesian c) { return new Complex_cartesian(a + c.getA(), b + c.getB()); } public Complex_cartesian multiply(Complex_cartesian c) { return new Complex_cartesian(a * c.getA() - b * c.getB(), b * c.getA() + a * c.getB()); } }