Answered step by step
Verified Expert Solution
Question
1 Approved Answer
NOTE *Please, also need a brief explanation of how the code works, Thanks in advance!* Implementation Your implementation will consist of adding C++ code to
NOTE *Please, also need a brief explanation of how the code works, Thanks in advance!*
Implementation Your implementation will consist of adding C++ code to implement two modules: polyterm.cpp and polynomial.cpp erm This module contains the implementation of the interface for the class used to represent the terms in a polynomial. Public methods to be implemented polyterm(double coefficient, unsigned int exponent) - constructor for the polynomial term based on a coefficient and an exponent. " double get_coefficient) - Returns the coefficient of this term. " unsigned int get_ exponent0 - Returns the exponent of this term void set-coefficient(double coefficient) -Sets the value of the coefficient for this term " void set exponent(unsigned int exponent) - Sets the value of the exponent for this " bool operator (const polyterm& T) - Equality operator. Returns true if both terms bool operator! (const polyterm& T) - Inequality operator. Returns true if the terms term have the same exponents and coefficients, or false otherwise are not equal, or false otherwise polyterm operator-0 Oposite operator. Returns a new term that has a coefficient with the opposite sign of the coefficient in this term. double operator0(double b) - Evaluation operator. Returns the value of the term when the value b is used as the value of the variable x in the term * polyterm derivative0 -computes the derivative of this term. " polyterm indefinite integral0 computes the indefinite integral (anti-derivative) Module: polvnomial.c This module contains the implementation of the interface for the polynomial class. Methods to be implemented " polynomialO - Creates a new polynomial with one term set to 0 * polynomial(const polyterm& new term) - Creates a new polynomial with one term. " const polynomial& operator+ (const polynomial& P) - Self-addition operator. Adds contents of this pol the contents of the argument polynomial to Equivalent expression: P0 = P0+ P1 yn " const polynomial& operator--(const polynomial& P) - Self-substraction operator from the contents of this Substracts the contents of the argument polynomial polynomial. Equivalent expression: P0 PO - P1, where PO is this polynomial. * void multiply term(const polynomial& P, const polyterm& T, polynomial& res) - multiplies a polynomial P by a term T, and stores the results in variable res const polynomial& operator*-(const polynomial& P)-Self-multiplication operator Multiplies the contents of the argument polynomial with the contents of this polynomial. Equivalent expression: P0 PO P1, where P0 is this polynomial . bool operator(const polynomial& P) - Determines if two polynomial are equal, based on wether or not they have the same terms " unsigned int degree0 - Returns the degree of the polynomial, which is the largest exponent of the any term. Implementation Your implementation will consist of adding C++ code to implement two modules: polyterm.cpp and polynomial.cpp erm This module contains the implementation of the interface for the class used to represent the terms in a polynomial. Public methods to be implemented polyterm(double coefficient, unsigned int exponent) - constructor for the polynomial term based on a coefficient and an exponent. " double get_coefficient) - Returns the coefficient of this term. " unsigned int get_ exponent0 - Returns the exponent of this term void set-coefficient(double coefficient) -Sets the value of the coefficient for this term " void set exponent(unsigned int exponent) - Sets the value of the exponent for this " bool operator (const polyterm& T) - Equality operator. Returns true if both terms bool operator! (const polyterm& T) - Inequality operator. Returns true if the terms term have the same exponents and coefficients, or false otherwise are not equal, or false otherwise polyterm operator-0 Oposite operator. Returns a new term that has a coefficient with the opposite sign of the coefficient in this term. double operator0(double b) - Evaluation operator. Returns the value of the term when the value b is used as the value of the variable x in the term * polyterm derivative0 -computes the derivative of this term. " polyterm indefinite integral0 computes the indefinite integral (anti-derivative) Module: polvnomial.c This module contains the implementation of the interface for the polynomial class. Methods to be implemented " polynomialO - Creates a new polynomial with one term set to 0 * polynomial(const polyterm& new term) - Creates a new polynomial with one term. " const polynomial& operator+ (const polynomial& P) - Self-addition operator. Adds contents of this pol the contents of the argument polynomial to Equivalent expression: P0 = P0+ P1 yn " const polynomial& operator--(const polynomial& P) - Self-substraction operator from the contents of this Substracts the contents of the argument polynomial polynomial. Equivalent expression: P0 PO - P1, where PO is this polynomial. * void multiply term(const polynomial& P, const polyterm& T, polynomial& res) - multiplies a polynomial P by a term T, and stores the results in variable res const polynomial& operator*-(const polynomial& P)-Self-multiplication operator Multiplies the contents of the argument polynomial with the contents of this polynomial. Equivalent expression: P0 PO P1, where P0 is this polynomial . bool operator(const polynomial& P) - Determines if two polynomial are equal, based on wether or not they have the same terms " unsigned int degree0 - Returns the degree of the polynomial, which is the largest exponent of the any termStep 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