In java Write a program to print the sum of two complex numbers by creating a class named as‘ComplexNumbers’ containing two data members, real and imaginary and two functions. Firstfunction named as ‘plus’ adds the given two complex numbers and updates the first complexnumber with the result and the second function named as 'print' prints the given sum in the format‘a + ib’ where a is the real part and b is the imaginary part. Take the real and imaginary parts ofboth the complex numbers as input from scanner and consider them to be positive integers.Input Format :Line 1 : Two integers- real and imaginary part of 1st complex numberLine 2 : Two integers- real and imaginary part of 2nd complex numberSample Input :4 56 7Sample Output :10 + i12
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here