Complex class project
From Huben's Wiki
(Created page with "This project will create a class called Complex that represents complex numbers. It will have 4 constructors, a constant field, a main() for testing, +, -, x and / operators and...") |
|||
Line 1: | Line 1: | ||
+ | [[Image:Complex-Numbers.jpg]] | ||
+ | |||
This project will create a class called Complex that represents complex numbers. It will have 4 constructors, a constant field, a main() for testing, +, -, x and / operators and a few other methods. | This project will create a class called Complex that represents complex numbers. It will have 4 constructors, a constant field, a main() for testing, +, -, x and / operators and a few other methods. | ||
Line 67: | Line 69: | ||
// System.out.println(c3.plus(c2)); // 1.0-5.5i | // System.out.println(c3.plus(c2)); // 1.0-5.5i | ||
// System.out.println(c3.minus(c2)); // -5.0-5.5i | // System.out.println(c3.minus(c2)); // -5.0-5.5i | ||
− | // System.out.println(c3.times(2.0)); // - | + | // System.out.println(c3.times(2.0)); // -4.0-11.0i |
// System.out.println(c3.times(c4)); // 12.5-17.0i | // System.out.println(c3.times(c4)); // 12.5-17.0i | ||
// System.out.println(c3.conjugate()); // -2.0+5.5i | // System.out.println(c3.conjugate()); // -2.0+5.5i |