| 5 | double real1, real2, imag1, imag2; |
| 6 | // Function to input data from user |
| 7 | public void get_data() { |
| 8 | Scanner sc = new Scanner(System.in); |
| 9 | System.out.println("Enter real part of first complex number: "); |
| 10 | real1 = sc.nextDouble(); |
| 11 | System.out.println("Enter imaginary part first of complex number: "); |
| 12 | imag1 = sc.nextDouble(); |
| 13 | System.out.println("Enter real part of second complex number: "); |
| 14 | real2 = sc.nextDouble(); |
| 15 | System.out.println("Enter imaginary part second of complex number: "); |
| 16 | imag2 = sc.nextDouble(); |
| 17 | } |
| 18 | // Function to display data that has been taken as input from user |
| 19 | public void display() { |
| 20 | System.out.println("Entered first complex number is: " + real1 + " + " + imag1 + "i"); |