Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help to finish this program: consicer the ADT polynomial in a single vari

ID: 3624319 • Letter: I

Question

I need help to finish this program:
consicer the ADT polynomial in a single variable x-whose operations include the following:
degree() //Returns the degree of a polynomial.
coefficient(power) //Returns the coefficient of the x-power term
changecoefficient(newcoefficient, poer) //replaces the coefficient of the x-power with newcoefficient.
for this problem consider only polynomials whose exponents are nonnegative integers. for example: p= 4x^5 + 7x^3 - x^2 +9
the following examples demonstrate the ADT operations on this polynomial.
p.dgree() is 5(the highst power of a term with a nonzero coefficient)
p.coefficient(3) is 7(the coefficient of the x^3 term)
p.coefficient(4) is 0 (the coefficient of a missing term is implicitly 0)
p.changecoefficient(-3,7) produces the polynomial p=-3x^7 +4x^5 +7x^3 -x^2 +9
using these ADT operations , writhe statements to perform the following tasks:
a. Display the coefficient of the term that has the highest power.
b. Increas the coefficient of the x^3 term by 8.
c. Compute the sum of two polynomials.
write pseudocode implementations of the ADT plolynomial operations.

Explanation / Answer


9a display(p.coefficient(p.degree()))

9b p.changeCoefficient(p.coefficient(3) + 8, 3)

9c for (power = 0; power < p.degree() || power < q.degree(); power++)
// R is the sum of polynomials P and Q to degree power. r.changeCoefficient(p.coefficient(power) +
q.coefficient(power), power)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote