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
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