Question: For the assignment, we will modify a program that created a solution for complex numbers using classes. Use the program complex.cpp and complex.hpp, located in

For the assignment, we will modify a program that created a solution for complex numbers using classes. Use the program complex.cpp and complex.hpp, located in this assignments folder. These are the implementation and program that created a class called Complex for performing arithmetic with complex numbers. The class enables so-called complex numbers. These are numbers of the form realPart + imaginaryPart * i

where i is: sqrt-1

For this assignment, you will make changes to the given coding to now include the following upgrades:

Modify the class to enable input and output of complex numbers via overloaded + and - operators, respectively (addition and subtraction).

Modify the class to enable input and output of complex numbers via overloaded = and * operators, respectively (assignment and multiplication).

Modify the class to enable input and output of complex numbers via overloaded >> and << operators, respectively (you should remove the print function from the class). Use friend functions to accomplish this.

Overload the == and != operators to allow comparisons of complex numbers.

Add friend member functions to enable input and output of complex numbers via overloaded >> and << operators, respectively (you should remove the print function from the class).

Change the Complex class definition, the Complex class member-function definitions, and use the driver program (the driver is also provided in the folder and it is called complex_main). Please use the test cases and execute the test cases successfully.

Can you please code this in c++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!