C++ programming language Please help me. If possible can the code be as simple as possible please? so i can understand. > optinal)The sum of The product of two complex numbers is given by...


C++ programming language


Please help me. If possible can the code be as simple as possible please? so i can understand.


Classes and operator overloading<br>Define a class for complex numbers. A complex number is a number of the<br>form:<br>a + b*i where<br>for<br>purposes,<br>and b are numbers<br>of type<br>our<br>a<br>double<br>and i is a number that represents the quantity v-1 (i * i = -1).<br>Represent<br>a complex number<br>two<br>values<br>of<br>type double.<br>Name<br>the<br>as<br>member variables real and imaginary. (The variable for the number that<br>is multiplied by i<br>is<br>the<br>called imaginary.)<br>Call<br>the<br>class<br>one<br>Complex.<br>Include a constructor with two parameters of type double that can be<br>used to set the member variables of an object to any values.<br>Include<br>constructor<br>that<br>has<br>only a single parameter<br>of<br>type<br>a<br>double ;<br>call this parameter realPart and define the constructor so<br>that the object will be initialized<br>to realPart + 0*i .<br>Include a<br>default constructor that initializes an object to 0 (that is, to 0 +<br>0*i).<br>Overload all the following operators<br>so<br>that they correctly apply to<br>the type Complex: +, -, *, «, (>> optinal)<br>The sum of The product of two complex numbers is given by the<br>following formula: (a + b*i)+(c + d*i) =<br>(a+c)+ (b+d) *i<br>The difference of The product of two complex numbers is given by the<br>following formula:<br>(а + b*i)-(с+d*i) %3<br>(а-с)+ (b-d) *i<br>The product of two complex numbers is given by the following<br>formula:<br>(a + b*i)* (c + d*i) =<br>(a*c<br>b*d) + (a*d + b*c) *i<br>You should also write a test program:<br>Instantiate four complex numbers C1=(1+4*i), C2=(-3-7i), C3= (4*i)and<br>C4= (-3+ i)<br>Add, subtract and multiply Cl and C2.<br>Add, subtract and multiply C3 and C4.<br>Use the overloaded « to display the result of the three operations<br>as follow:<br>

Extracted text: Classes and operator overloading Define a class for complex numbers. A complex number is a number of the form: a + b*i where for purposes, and b are numbers of type our a double and i is a number that represents the quantity v-1 (i * i = -1). Represent a complex number two values of type double. Name the as member variables real and imaginary. (The variable for the number that is multiplied by i is the called imaginary.) Call the class one Complex. Include a constructor with two parameters of type double that can be used to set the member variables of an object to any values. Include constructor that has only a single parameter of type a double ; call this parameter realPart and define the constructor so that the object will be initialized to realPart + 0*i . Include a default constructor that initializes an object to 0 (that is, to 0 + 0*i). Overload all the following operators so that they correctly apply to the type Complex: +, -, *, «, (>> optinal) The sum of The product of two complex numbers is given by the following formula: (a + b*i)+(c + d*i) = (a+c)+ (b+d) *i The difference of The product of two complex numbers is given by the following formula: (а + b*i)-(с+d*i) %3 (а-с)+ (b-d) *i The product of two complex numbers is given by the following formula: (a + b*i)* (c + d*i) = (a*c b*d) + (a*d + b*c) *i You should also write a test program: Instantiate four complex numbers C1=(1+4*i), C2=(-3-7i), C3= (4*i)and C4= (-3+ i) Add, subtract and multiply Cl and C2. Add, subtract and multiply C3 and C4. Use the overloaded « to display the result of the three operations as follow:
7*i)<br>7*i)<br>|(1 + 4*i) + (-3<br>|(1 + 4*i)<br>|(1 + 4*i) * (-3 - 7*i)<br>(4*i) + (-3 + i)<br>(4*i)<br>|(4*i)<br>-2<br>3*i<br>%3D<br>(-3<br>4 + 11*i<br>-<br>%3D<br>25<br>19*i<br>-3 + 5*i<br>%3D<br>(-3 + i)<br>(-3 + i)<br>3 + 3*i<br>=<br>-4<br>12*i<br>%3D<br>||<br>||<br>

Extracted text: 7*i) 7*i) |(1 + 4*i) + (-3 |(1 + 4*i) |(1 + 4*i) * (-3 - 7*i) (4*i) + (-3 + i) (4*i) |(4*i) -2 3*i %3D (-3 4 + 11*i - %3D 25 19*i -3 + 5*i %3D (-3 + i) (-3 + i) 3 + 3*i = -4 12*i %3D || ||
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here