Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

=+ (b) Show that log2 n + log2 log, log, n is an inner boundary.

Answered: 1 week ago

Question

What will you do or say to Anthony about this issue?

Answered: 1 week ago