Question: Create a class for working with complex numbers. Only 2 private float data members are needed, the real part of the complex number and the
Create a class for working with complex numbers. Only 2 private float data members are needed, the real part of the complex number and the imaginary part of the complex number The following methods should be in your class: a. A default constructor that uses default arguments in case no initializers are included in the main. b. Add two complex numbers and store the sum. c. Subtract two complex numbers and store the difference. d. Multiply two complex numbers and store the product. e. Print a complex number in the form a + bi or a - bi where a is the real part of the complex number and b is the imaginary part of the complex number. f. Change a complex number to its square. Your main should instantiate two complex numbers and call each of the class methods. The two complex numbers should be printed along with the sum, difference, and product of the two complex numbers. Lastly, print the squares of the two complex numbers. (Please do not overload the operators for this program.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
