Write an adapter class that uses a linked list to implement a polynomial. The po
ID: 3639832 • Letter: W
Question
Write an adapter class that uses a linked list to implement a polynomial. The polynomial class should store ONLY those terms that are defined in the polynomial.
That is if the polynomial is 5x4 + 2x + 1, the class should contain the storage to represent only the three terms.
Operations:
a. Default constructor that initialize a polynomial object.
b. SetTerm(exponent, coefficient ) - a member function that adds a term to a
polynomial object.
c. GetTerm(exponent) – a member function returns the coefficient of the
polynomial with the given exponent.
d. Provided an overloaded + operator to handle expressions that add a constant to each component in the current polynomial. For example, the expression
P + 5;
adds the constant 5 to each coefficient in P. .
e. Compute( x) – a member function that substitutes the parameter value for x to compute the integer result of the polynomial. Compute the value as
result += static_cast ( pow ( static_cast(x), i ) ) * coefficient i
f. Overload the << operator to print out a polynomial as
P(x) = cn x** yn + cn-1 x ** yn-1 + ... + c1 x ** y1 + c0
Explanation / Answer
done, I have pmed the soln
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.