Lab Static Method, Part II
public class complex{
private double i,r;
public void setNumber(double a,double b)
{
i=a;
r=b;
}
public void add(complex num)
{
i=i+num.i;
r=r+num.r;
}
public void Output()
{
System.out.println("the answe="+i+"+"+r+"i");
}
}
0 Comments:
Post a Comment
<< Home