code :
class ComplexNumber
{
double real;
double imaginary;
ComplexNumber(double a, double b)
{
real=a;
imaginary=b;
}
void sum(ComplexNumber x, ComplexNumber y)
{
double A= x.real + y.real;
double B= x.imaginary+y.imaginary;
System.out.println("The required sum is :" +A+"i"+B);
}
}
class Complex
{
public static void main(String args[])
{
ComplexNumber T = new ComplexNumber(2.3,0.4);
ComplexNumber M = new ComplexNumber(2.3,0.5);
sum(T,M);
}
}
I modified it to this but still not working, giving error in method sum, and in the line >>> sum(T,M)
NB : This is not mu homework, I am really a newbie and working hard for my next semister as
Java is too big to grasp in 1 sem.; as all my Profs. is busy now in their projects, I am facing problem amd providing the same answer to all(including you) that this is NOT my H.W.