Starting from:

$30

MyComplex Requirements

MyComplex Requirements
Complex numbers are very useful in the fields of Electrical and Computer Engineering. They are often
used to represent impedances, voltages, and currents. A complex number consists of a real part and an
imaginary part, and a typical representation is:
4.5 + 3.7i
where the term including “i” represents the imaginary part.
Design a C++ class called MyComplex that provides the following public member functions:
MyComplex();
MyComplex(float rp, float ip);
void printMyComplex();
Additionally, the MyComplex class should support the addition, subtraction, and multiplication
operators using operator overloading. Use Google to review how addition, subtraction, and
multiplication are performed on complex numbers.
Submit MyComplex.h and MyComplex.cpp files as a zip file. The grader will compile your class with a
main.cpp provided by the instructor.
Example Output
If the instructor-provided main.cpp file looks like this:
#include <iostream
#include "MyComplex.h"
using namespace std;
int main()
{
MyComplex a(3.0, 2.5);
MyComplex b(1.2, 4.4);
MyComplex c;
c = a * b;
c.printMyComplex();
return 0;
}
The output should look something like this:
-7.4 + 16.2i

More products