Question: -Cosider the ADT polynomial in a single variable x whose operatrions include the following: +degree():integer {query} //Returns the degree of a polynomial. +getCoefficient (in power:integer):

-Cosider the ADT polynomial in a single variable x whose operatrions include the following:

+degree():integer {query}

//Returns the degree of a polynomial.

+getCoefficient (in power:integer): integer

//Returns the coefficient of the x^power term.

+changeCoefficient (in newCoef:integer, in power: integer)

//Replaces the coefficient of the x^power term

//with newCoef.

-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.degree() is 5 (the highest power of a term with a nonzero coefficient)

p.getCoefficient (3) is 7 (the coefficient of the x^3 term)

p.getCoefficient (4) is 0 (the coefficient of a missing term is implicitly 0)

p.changeCoefficient (-3, 7) produce the polynomial

p= -3x^7 + 4x^5 + 7x^3 - x^2 + 9

-Using only the ADT operations provided, write statements to perform the following tasks:

a. Display the constant term (the coefficient for the x^0 term).

b. Change each coefficient in the polynomial by multiplying them by 5.

c. For a given polynomial such as p= -3x^7 + 4x^5 + 7x^3 - x^2 + 9, display the expression in the form -3x^7 + 4x^5 + 7x^3 - 1x^2 + 9.

d. Change the polynomial to its derivative,for example, p= -3x^7 + 4x^5 +7x^3 - x^2 +9 becomes p= -21x^6 + 20x^4 + 21x^2 - 2x^1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!