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

Develop a class to represent and manipulate polynomials. A polynomial can be rep

ID: 3827298 • Letter: D

Question

Develop a class to represent and manipulate polynomials. A polynomial can be represented as a linked list of terms where each term consists of the exponent and the coefficient. An example of a polynomial is 3x+4x4 - x 2 + 2x3 . The linked list should be sorted in ascending order by the exponents of its terms. Please observe the following: • The polynomial term is a struct with two integer members representing the exponent and the coefficient. • Provide a default constructor, copy constructor and a destructor. • Overload the assignment operator. • Overload the + operator to add two polynomials. The resulting polynomial must be simplified (i.e. each exponent appears only once) • Overload the stream insertion operator to display the polynomial in the format: 3x^1 + 4x^4 – 1x^2 + 2x^3 • Provide a function to insert a new term to an existing polynomial. The new term should be inserted in its correct location and should not result in a duplicated exponent. • Provide a function to remove the term with a given exponent from the polynomial. • Provide a client program that tests each of the requested operation.

Explanation / Answer

Struct for polyomial term:

struct node
{
float coefficient;
int exponent;
struct node *next;
}