realPart = $realPart; $this->imaginaryPart = $imaginaryPart; $this->suffix = strtolower($suffix); } public function getReal() { return $this->realPart; } public function getImaginary() { return $this->imaginaryPart; } public function getSuffix() { return $this->suffix; } public function __toString() { $str = ""; if ($this->imaginaryPart != 0.0) $str .= $this->imaginaryPart . $this->suffix; if ($this->realPart != 0.0) { if ($str) $str = "+" . $str; $str = $this->realPart . $str; } if (!$str) $str = "0"; return $str; } }