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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started