Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I keep getting error squiggles In this programming assignment, you will use the Standard Template Library to program a polynomial. A polynomial has terms each
I keep getting error squiggles
In this programming assignment, you will use the Standard Template Library to program a polynomial. A polynomial has terms each of which has a coefficient that multiplies into an unknown raised to a power. For example, 2x5 - 5x4+x3+3x2+ 9x - 4 is a polynomial. 1. First write a Term class. Here is the specification of the member functions of Term class in the public section: Term(int coef, int expon) Constructor for objects of class Term. Represents coef * x expon Parameters: coef - the coefficient value expon - the exponent value Term(const Term &term) This is a constructor for objects of class Term whose objects represents coef * x expon Parameter: term an object of class Term int getCoefficient() Fetch coefficient value. Returns: the coefficient value int getExponent() Fetch exponent value. Returns: the exponent value void setCoefficient(int coef) Replace coefficient value with new one. Postcondition: getCoefficient) coef Parameters: coef - the new coefficient vstlue. w WWW void setExponent(int expon) Replace exponentt value with new one. Postcondition: getExponent() expon Parameters: expon - the new coefficient value. bool operator (Term &term) Imposes "natural ordering" on Term objects. This permits arrays and STL lists of Term objects to be sorted and arranged by STL algorithms and member functions. Ordering is based primarily on exponent value and secondarily on coefficient value (e.g. if exponents are equal, decision is based on coefficients). bool operator>Term &term) Imposes "natural ordering" on Term objects. This permits arrays and STL lists of Term objects to be sorted and arranged by STL algorithms and member functions. Ordering is based primarily on exponent value and secondarily on coefficient value (e.g. if exponents are equal, decision is based on coefficients). Parameters: term - The Term against which "this" Term is compared Returns: Returns true if this" Term object is equal to term and false otherwise. bool operator (Term &term) Imposes "natural ordering" on Term objects. This permits arrays and STL lists of Term objects to be sorted and arranged by STL algorithms and member functions. Ordering is based primarily on exponent value and secondarily on coefficient value (e.g. if exponents are equal, decision is based on coefficients). Parameters: term - The Term against which "this" Term is compared Returns: Returns true if this Term object is less than term and false otherwise. void combine(Term term) Combines "this" term and the argument term back into "this" term. Terms are combined by adding their coefficients. Parameters: term - the term to be folded into "this" term. Term &product(Term &a, Term &b) Returns a Term formed by the profluct of two Terms. The product (multiplication) is a term formed by multiplying the coefficients and adding the exponents. For example, the product of 3x2 and 4x is 12x3. Parameters: a - first term in the product. b - second term in the product. Returns: a new Term containing the product of the two argument terms. string toString/ Returns a string representing of this term, with fully signed coefficient and using nothing for multiplication and for exponentiation. Returns: a string equivalent of this term. Second write a Polynomial class. The polynomial class will have an instance variable in the private section with this declaration: listStep 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