Question: Define a class Polynomial with three private data members a, b and c (type double) to represent the coefficients of a 2-degree polynomial :(ax 2
Define a class Polynomial with three private data members a, b and c (type double) to represent the coefficients of a 2-degree polynomial :(ax2 + bx + c).Include a constructor in the Poly class to initialize private data members with user-supplied values (in addition to the default constructor). The class overloads the addition(+)and subtraction (-) operators to return the sum/subtraction of two polynomial objects. Also define a showpoly() member function to output Poly objects in the specified format, i.e. ax2 + bx + c where a, b and c are the coefficients. Do not display the terms with (x2 or x) if these have zero coefficients. Moreover, if the value of the coefficient is negative it should be preceded by a minus sign.Also overload equality operator (= =) that compares the two quadratic polynomials numbers and returns the result in Boolean form.
Class also overloads the increment (++) and decrement (--) operator that increases and decreases the value of all coefficients of a polynomial equation. Besides, class also have the Copy Constructor and destructor. Make the appropriate member function as const.
In your main () function, declare and initialize Poly objects, to represent the polynomials equation.
Hint: you may include "math.h" header file for using mathematical functions (e.g. sqrt() for calculating the square root of a value)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
