Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 + + 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
Step: 1
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 ...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