Question: using c++ will have to run on mac Consider the polynomial - in a single variable x-whose operations include the following: degree I/Returns the degree
Consider the polynomial - in a single variable x-whose operations include the following: degree I/Returns the degree of a polynomial coefficient power) // Returns the coefficient of the power term chageCoefficientinewCoefficient power) / Replaces the coefficient of the xpower term with newcoefficient. For this problem, consider only polynomials whose exponents are nonnegative integers. For example, p=4x. 73.2.9 The following examples demonstrate the operations on this polynomial p.degree is 5 (the highest power of a term with a nonzero coefficient) p.coeficient[3) is 7 (the coefficient of the term) p.coefficient(4) is the coefficient of a missing term is implicitly 0) p.chengeCoefficient(-3,7) produces the polynomial p=-3x?+ 4x +7-29 Using these operations, write statements to perform the following tasks: a) Display the coefficient of the term that has the highest power. b) Increase the coefficient of the term by 8. c) Compute the sum of two polynomials. p and al Consider a sparse implementation of the polynomial that stores only the terms with nonzero coefficients. Complete this sparse implementation e) Define a traverse operation for the sparse implementation of a polynomial that will allow you to add two sparse polynomials without having to consider terms with zero coefficients explicitly. Test Data for a) and b) p.3x2+62+72-8x?+9.24 Test Data forck P-32.6x9.72-8x?+ 9-2X4 q=9x-2x84x2+6X+2+7x4 Test Data for d) and exp-6x10.8x25.-4x39x+5x4 = 43x24 7x10.4x25 + 12x +2+374 + + 9x Requirements: 1) Use these test data above for your program 2) Please turn both your source code and the output. Note: Use screen print to capture the output according to the specified test data
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
