Question: Design and implement a class that for polynomials anxn + an-1xn-1 + + a1x + a0 with integer coefficients. The coefficients and the degree

Design and implement a class that for polynomials anxn + an-1xn-1 + 

Design and implement a class that for polynomials anxn + an-1xn-1 + + a1x + a0 with integer coefficients. The coefficients and the degree are data members. The class operations should include addition, subtraction, multiplication and evaluation of a polynomial. Overload +,- and * and implement the evaluation as a member function with an int argument. The evaluation member function returns the value obtained by plugging in its argument for x and performing the indicated operations. Include a default constructor, a copy constructor, and a constructor that takes two arguments: a pointer to int and an int(this is just a dynamic array). Include a suitable destructor and suitable functions to input and output polynomials by overloading < < and >>. Write a driver program to test each of the capabilities of this class. (see problem 10.11, Ch 10, p.495) 10.11 (Polynomial Class) Develop class Polynomial. The internal representation of a Polynomial is an array of terms. Each term contains a coefficient and an exponent-e.g., the term 2x4 496 Chapter 10 Operator Overloading; Class string has the coefficient 2 and the exponent 4. Develop a complete class containing proper constructor and destructor functions as well as set and get functions. The class should also provide the following overloaded operator capabilities: a) Overload the addition operator (+) to add two Polynomials. b) Overload the subtraction operator (-) to subtract two Polynomials. c) Overload the assignment operator to assign one Polynomial to another. d) Overload the multiplication operator (*) to multiply two Polynomials.

Step by Step Solution

3.48 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Develop class Polynomial The internal representation of a Polynomial is an array of terms Each term contains a coefficient and an exponenteg the term 2x4 496 has a coefficient of 2 and an exponent of ... View full answer

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 Algorithms Questions!