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
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. Grading table: Item Mark Comments, indentation, variable naming /3 Definition of the struct /4 Definition of Polynomial class /10 Implementation of the default constructor /4 Implementation of the copy constructor /10 Implementation of the destructor /4 Implementation of the assignment operator /10 Implementation of the stream insertion operator /10 Implementation of the + operator /10 Implementation of the insertTerm function /10 Implementation of the removeTerm function /10 Implementation of the Client program /10 Program compiles correctly /5 Total /100
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