Question: In C++ This will be a multi-part assignment. Later homework will expand upon what is developed in this assignment. 1. Create a class called MyComplex
In C++
This will be a multi-part assignment. Later homework will expand upon what is developed in this assignment.
1. Create a class called MyComplex to represent complex numbers. Each part (Real and Imaginary parts) should be stored as a double. Data members should be private and you need to supply appropriate accessor and mutator methods.
2. Supply a default constructor (both parts zero), a constructor that allows the real part to be set and a third constructor that allows both parts to be set.
3. Supply an insertion operator that will allow the value of a complex number to be printed. The output should look like: 2+3i, 1-4i, -2+0i, 0+5i for example.
4. Supply a complete program that exercises your class. (be sure you also exercise the accessor and mutator functions).
You must supply a listing of your program and sample output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
