Question
Hello, I need help with my java home work problem -Cosider the ADT polynomial in a single variable x whose operatrions include the following: +degree():integer
Hello, I need help with my java home work problem
-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
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