import [Link].
Scanner;
class complex {
Double real;
Double imag;
public void getdata(Scanner sc) {
[Link](" Enter the real part of the complex number :");
[Link] = [Link]();
[Link](" Enter the imaginary part of the complex number :");
[Link] = [Link]();
}
public void display() {
[Link]("Complex number :" + [Link] + "+" + [Link] + "i");
}
public void add(complex c) {
complex c3 = new complex();
[Link] = [Link] + [Link];
[Link] = [Link] + [Link];
[Link]("Addition:");
[Link]();
}
public void sub(complex c) {
complex c3 = new complex();
[Link] = [Link] - [Link];
[Link] = [Link] - [Link];
[Link]("Subtraction:");
[Link]();
}
public void compare(complex c) {
if ([Link]([Link]) && [Link]([Link])) {
[Link]("Complex numbers are equal.");
} else {
[Link]("Complex numbers are not equal.");
}
}
}
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner([Link]);
{
[Link]("Complex numbers:");
complex c1 = new complex();
complex c2 = new complex();
[Link](sc);
[Link]();
[Link](sc);
[Link]();
[Link](c2);
[Link](c2);
[Link](c2);
}
}
}