Class Complex


public final class Complex
extends Object

Complex Class of the complex numbers Calculating with complex numbers, divided into an imaginary number and a real number. Author: Christiane Adler

Field Summary

private double
imaginary
private double
real

Constructor Summary

Complex()
Complex(Complex other)
Constructor, getting a complex number
Complex(double real, double imaginary)
Constructor, getting the real and the imaginary numbers

Method Summary

double
absolute()
Calculats the absolute of a complex number and returns this result.
Complex
add(Complex other)
Calculating: Add a Complex to a Complex
Complex
add(double real)
Calculating: Add a real number to a Complex
Complex
division(Complex other)
Divides a complex number with another complex number and returns this result.
Complex
division(double real)
Divides a complex number with a real number and returns this result.
Complex
getComplex()
Returns the Complex
double
getImaginary()
Returns the imaginary number of a Complex
double
getReal()
Returns the real number of a Complex
Complex
multiply(Complex other)
Calculating: Multiply a Complex to a Complex
Complex
multiply(double real)
Calculating: Multiply a real number to a Complex
void
setImaginary(double imaginary)
Setting the imaginary number in a Complex
void
setReal(double real)
Setting the real number in a Complex
Complex
sub(Complex other)
Calculating: Subtrahate a Complex to a Complex
Complex
sub(double real)
Calculating: Sub a real number to a Complex

Field Details

imaginary

private double imaginary

real

private double real

Constructor Details

Complex

public Complex()

Complex

public Complex(Complex other)
Constructor, getting a complex number

Complex

public Complex(double real,
               double imaginary)
Constructor, getting the real and the imaginary numbers

Method Details

absolute

public double absolute()
Calculats the absolute of a complex number and returns this result.

add

public Complex add(Complex other)
Calculating: Add a Complex to a Complex

add

public Complex add(double real)
Calculating: Add a real number to a Complex

division

public Complex division(Complex other)
Divides a complex number with another complex number and returns this result.

division

public Complex division(double real)
Divides a complex number with a real number and returns this result.

getComplex

public Complex getComplex()
Returns the Complex

getImaginary

public double getImaginary()
Returns the imaginary number of a Complex

getReal

public double getReal()
Returns the real number of a Complex

multiply

public Complex multiply(Complex other)
Calculating: Multiply a Complex to a Complex

multiply

public Complex multiply(double real)
Calculating: Multiply a real number to a Complex

setImaginary

public void setImaginary(double imaginary)
Setting the imaginary number in a Complex

setReal

public void setReal(double real)
Setting the real number in a Complex

sub

public Complex sub(Complex other)
Calculating: Subtrahate a Complex to a Complex

sub

public Complex sub(double real)
Calculating: Sub a real number to a Complex