Question: Write a C + + program that creates a class called complex performing arithmetic with complex numbers. Write a program to test your class. Complex
Write a C program that creates a class called complex performing arithmetic with complex numbers. Write a program to test your class. Complex numbers have the form:
realPart imaginaryPart i
Where i is
Use double variables to represent data of the class. Provide a constructor that
enables an object of this class to be initialized when it is declared. The constructor
should contain default values in case no initializers are provided. Also, a function
to assign data to data fields. Provide functions for each of the following:
a Adding two complex numbers. The real parts are added together and the
imaginary parts are added together.
b Subtracting two complex numbers. The real part of the right operand is
subtracted from the real part of the left operand, and the imaginary part of the
right operand is subtracted from the imaginary part of the left operand.
c Multiplying two Complex numbers.
d Printing complex numbers in the form a b where a is the real part and b is
the imaginary part.
Example of what results should look like:
a
b
a b
a b
a b
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
