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. First function named as...


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. First

function named as ‘plus’ adds the given two complex numbers and updates the first complex

number 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 of

both 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 number
Line 2 : Two integers- real and imaginary part of 2
nd complex number
Sample Input :
4 5
6 7
Sample Output :
10 + i12



Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here