Question: Polynomial_app.cpp #include #include Polynomial.h using namespace std; int main() { Polynomial a, b, c, t; a.enterTerms(); b.enterTerms(); t = a; // save the value of

Polynomial_app.cpp

#include #include "Polynomial.h" using namespace std;

int main() { Polynomial a, b, c, t;

a.enterTerms(); b.enterTerms(); t = a; // save the value of a cout

system("PAUSE"); //remove this if you are not using windows return 0; } // end main

Your solution that you submit should consist of two (2) files:

Polynomial.h (class specification file) Polynomial.cpp (class implementation file)

The application program (Polynomial_app.cpp) has already been completed for you. Your Polynomial class should work with the Polynomial_app.cpp application program that has been given to you.

Develop class Polynomial. The internal representation of a Polynomial is an array or vector of terms. Each term contains a coefficient and an exponent, e.g., the term

2x4

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 addition assignment operator (+=). e. Overload the subtraction assignment operator (-=).

Beyond overloading these operators, the code in the polynomial_app.cpp will give you an idea of what member functions you need to implement in the Polynomial class.

Sample Run 1 (using polynomial_app.cpp):

Polynomial_app.cpp #include #include "Polynomial.h" using namespace std; int main() { Polynomial a,

b, c, t; a.enterTerms(); b.enterTerms(); t = a; // save the value

Sample Run 2 (using polynomial_app.cpp):

of a cout system("PAUSE"); //remove this if you are not using windows

return 0; } // end main Your solution that you submit should

Sample Run 3 (using polynomial_app.cpp):

consist of two (2) files: Polynomial.h (class specification file) Polynomial.cpp (class implementation

file) The application program (Polynomial_app.cpp) has already been completed for you. Your

Enter number of polynomial terms: 5 Enter coefficient: 1 Enter exponent: 4 Enter coefficient: 2 Enter exponent: 3 Enter coefficient: 3 Enter exponent: 2 Enter coefficient: 4 Enter exponent: 1 Enter coefficient: 5 Enter exponent:e Enter number of polynomial terms: 4 Enter coefficient: 5 Enter exponent: 4 Enter coefficient: 4 Enter exponent: 3 Enter coefficient: 3 Enter exponent: 2 Enter coefficient: 2 Enter exponent: 1 Enter number of polynomial terms: 5 Enter coefficient: 1 Enter exponent: 4 Enter coefficient: 2 Enter exponent: 3 Enter coefficient: 3 Enter exponent: 2 Enter coefficient: 4 Enter exponent: 1 Enter coefficient: 5 Enter exponent:e Enter number of polynomial terms: 4 Enter coefficient: 5 Enter exponent: 4 Enter coefficient: 4 Enter exponent: 3 Enter coefficient: 3 Enter exponent: 2 Enter coefficient: 2 Enter exponent: 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!