Question: Beginner Java homework 2- Complete the complex numbers functions as instructed in the comments above the functions: public class Complex { private double real; private

Beginner Java homework 2- Complete the complex numbers functions as instructed in the comments above the functions:

public class Complex {

private double real;

private double imaginary;

// Constructs an instance, given its real and imaginary components.

public Complex(double real, double imaginary)

{

}

// Constructs an instance that duplicates source.

public Complex(Complex source)

{

}

// Getter method.

public double getReal()

{

}

// Getter method.

public double getImaginary()

{

}

// Constructs and returns a new instance of Complex that represents the sum of its inputs, according to the following formula:

// (a+bi) plus (c+di) = (a+c) + (b+d)i

public static Complex add(Complex c1, Complex c2)

{

}

// Constructs and returns a new instance of Complex that represents the product of its inputs, according to the following formula:

// (a+bi) times (c+di) = a*c + a*di + bi*c + bi*di = ac + (ad+bc)i + bd*ii

// Since ii is -1 by definition, the last term is -bd ==> the result is ac-bd + (ad+bc)i

public static Complex multiply(Complex c1, Complex c2)

{

}

// The "norm" of complex number a+bi is the square root of (a^2 + b^2).

public double norm()

{

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!