PLEASE DO IN C++ (Math: The Complex class) The description of this project is given in Programming Exercise 14.7 in the Chapter 14 Programming Exercise from the Book section. If you get a logical or runtime error, please refer https://liangcpp.pearsoncmg.com/faq.html. Design a class named Complex for representing complex numbers and the functions add, subtract, multiply, divide, abs for performing complex-number operations, and the toString function for returning a string representation for a complex number. The toString function returns a+bi as a string. If b is 0, it simply returns a. Provide three constructors Complex(a, b), Complex(a), and Complex(). Complex() creates a Complex object for number 0 and Complex(a) creates a Complex object with 0 for b. Also provide the getRealPart() and getImaginaryPart() functions for returning the real and imaginary part of the complex number, respectively. Overload the operators +, -, *, /, +=, -=, *=, /=, [], unary + and -, prefix ++ and --, postfix ++ and --, <<, >>. Overload [] so that [0] returns a and [1] returns b. Overload the relational operators <, <=, ==, !=, >, >= by comparing the absolute values of two complex numbers. Overload the operators +, -, *, /, <<, >>, <, <=, ==, !=, >, >= as nonmember functions. PLEASE DO IN C++
PLEASE DO IN C++
(Math: The Complex class)
The description of this project is given in
Design a class named Complex for representing complex numbers and the functions add, subtract, multiply, divide, abs for performing complex-number operations, and the toString function for returning a string representation for a complex number. The toString function returns a+bi as a string. If b is 0, it simply returns a.
Provide three constructors Complex(a, b), Complex(a), and Complex(). Complex() creates a Complex object for number 0 and Complex(a) creates a Complex object with 0 for b. Also provide the getRealPart() and getImaginaryPart() functions for returning the real and imaginary part of the complex number, respectively.
Overload the operators +, -, *, /, +=, -=, *=, /=, [], unary + and -, prefix ++ and --, postfix ++ and --, <<, >>.
Overload [] so that [0] returns a and [1] returns b.
Overload the relational operators <, <=, ==, !=, >, >= by comparing the absolute values of two complex numbers.
Overload the operators +, -, *, /, <<, >>, <, <=, ==, !=, >, >= as nonmember functions.
PLEASE DO IN C++
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 5 images