No Tribble At All
From Huben's Wiki
Line 2: | Line 2: | ||
Copy this code into Dr. Java. Then follow the numbered instructions. | Copy this code into Dr. Java. Then follow the numbered instructions. | ||
+ | |||
+ | For those of you who have forgotten complex math, assume two complex numbers a and b. | ||
+ | |||
+ | a + b = (a<sub>real</sub> + b<sub>real</sub>) + (a<sub>imag</sub> + b<sub>imag</sub>) | ||
+ | |||
+ | a * b = (a<sub>real</sub> * b<sub>real</sub> - a<sub>imag</sub> + b<sub>imag</sub>) + (a<sub>real</sub> * b<sub>imag</sub> + a<sub>imag</sub> + b<sub>real</sub>) | ||
+ | |||
<pre> | <pre> | ||
// Write a class Complex similar to your class Fraction. | // Write a class Complex similar to your class Fraction. |