HELP PLEASE WILL RATE LIFESAVER!!! Create a class definition for a Polynomial. T
ID: 3614271 • Letter: H
Question
HELP PLEASE WILL RATE LIFESAVER!!! Create a class definition for a Polynomial.The member data in the polynomial will be its degree as well as itscoefficients.
You should overload the +, -, and * operators for Polynomial.
You should also overload * so that you can multiply a constant bythe polynomial.
You should also overload / so that you can divide the polynomial bya constant.
Include a function called evaluate which will evaluate thepolynomial for the value specified by the parameter.
You should overload the = operator and include a copy constructorand destructor.
Also include a function to display the polynomial.
HELP PLEASE WILL RATE LIFESAVER!!! Create a class definition for a Polynomial.
The member data in the polynomial will be its degree as well as itscoefficients.
You should overload the +, -, and * operators for Polynomial.
You should also overload * so that you can multiply a constant bythe polynomial.
You should also overload / so that you can divide the polynomial bya constant.
Include a function called evaluate which will evaluate thepolynomial for the value specified by the parameter.
You should overload the = operator and include a copy constructorand destructor.
Also include a function to display the polynomial.
Explanation / Answer
#include <stdlib.h>
int Degree;
class Polynomial
{
protected:
int size[Degree];
public:
Polynomial(){}
Polynomial (int degree);
void outputPolynomial();
};
Polynomial::Polynomial (int degree)
{
for(inta=0;a<=degree;a++)
{
size[a]=0;
}
void Polynomial::outputPolynomial()
{
int b=5;
cout<<endl;
for(inta=0;size[a]=='';a++)
{
cout<<size[a]<<"x"<<"^"<<b<<" ";
b--;
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.