Can you help me with this ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can you help me with this ?

Define a class Complex to manipulate complex numbers. This class will contain: — 2 private variables of type double for the real part and the imaginary part of the complex number — a constructor having 2 parameters of type double — a constructor having one parameter of type Complex — a method to compute the absolu te value of a complex number (meaning the square root of re*re+im*im, where re= the real part and im = the imaginary part) — overwrite the method toString to print real_part+i*imaginary_part

19th Apr 2018, 7:39 AM
Lupan Cristian
Lupan Cristian - avatar
3 Answers
0
Is this your home work or What?
19th Apr 2018, 7:53 AM
Bharath_Teki 🇮🇳
Bharath_Teki 🇮🇳 - avatar
0
you can say that :)
19th Apr 2018, 8:02 AM
Lupan Cristian
Lupan Cristian - avatar
0
class Complex{ private double Real; private double Imaginary; public Complex(double a, double b){}; public Complex(Complex a){}; public double ComputeAbsoluteValue{}; } now you have to fill constructors, ComputeAbsoluteValue and overwtite toString method.
19th Apr 2018, 8:52 AM
Sergey Semendyaev
Sergey Semendyaev - avatar