c++
#include using namespace std; class Poly { private: double a, b, c; public: Poly() { a = b = c = 1; } Poly(double x, double y, double z) { a = x; b = y; c = z; } Poly operator+(Poly p) { Poly sum; sum.a = a + p.a; sum.b = b + p.b; sum.c = c + p.c; return sum; } friend std::ostream &operator
#include The complex class: #include using namespace std; class Complex { double real; double imag; public: Complex() { real = 0.0; imag = 0.0; } Complex(double r,double i) { real = r; imag = i; } double getReal() { return real; } double getImag() { return imag; } void setReal(double r) { real = r; } void setImag(double i) { imag = i; } friend ostream &operator0&&D.real>0) output>( istream &input, Complex &D ) { input>>D.real>>D.imag; return input; } Complex operator +(Complex obj) { Complex temp; temp.real=real+obj.real; temp.imag=imag+obj.imag; return temp; } void operator -() { real=-real; imag=-imag; } }; int main() { Complex c1,c2,c3; cout > c1 >> c2; c3 = c1+c2; cout Extend the Poly class to support the evaluation of quadratic polynomials as follows: 1. Add a member function named eval that takes a single double argument representing t he value and returns the result (type double) of evaluating the polynomial atx. 2. Add a void member function named roots that will take two reference arguments of type Complex (use your Complex class), then compute and provide both roots of a quadratic polynomial object. Recall that the roots are given by the quadratic equation: The expression under the radical is referred to as the discriminant. If the discriminant is negative, the roots must be expressed as imaginary values using Complex numbers as follows: Cl CU The roots method should first determine if the roots are real or imaginary based on the value of the discriminant. If the roots are real, return them as complex values with the imaginary component set to zero, if the roots are imaginary, return them in complex form using the absolute value of the discriminant Extend the Poly class to support the evaluation of quadratic polynomials as follows: 1. Add a member function named eval that takes a single double argument representing t he value and returns the result (type double) of evaluating the polynomial atx. 2. Add a void member function named roots that will take two reference arguments of type Complex (use your Complex class), then compute and provide both roots of a quadratic polynomial object. Recall that the roots are given by the quadratic equation: The expression under the radical is referred to as the discriminant. If the discriminant is negative, the roots must be expressed as imaginary values using Complex numbers as follows: Cl CU The roots method should first determine if the roots are real or imaginary based on the value of the discriminant. If the roots are real, return them as complex values with the imaginary component set to zero, if the roots are imaginary, return them in complex form using the absolute value of the discriminant