Question: C++ Polynomial Project Must be written in C++ language. The header file is included and must create an implementation of the functions in a CPP

C++ Polynomial Project

Must be written in C++ language. The header file is included and must create an implementation of the functions in a CPP file as well as create a main driver CPP file to test the functions. A key part of the project is the syntax of the input/output. For example to output x^2 + 3x +5 the user has to input 1 2 3 1 5 0 0 //

C++ Polynomial Project Must be written in C++ language. The header fileis included and must create an implementation of the functions in aCPP file as well as create a main driver CPP file totest the functions. A key part of the project is the syntaxof the input/output. For example to output x^2 + 3x +5 theuser has to input 1 2 3 1 5 0 0 //

header file:

#ifndef __POLYNOMIAL_H_ #define __POLYNOMIAL_H_ #include #include using namespace std; //template struct ZERO_T { static const short /*NumT*/ ZERO = 0; }; template class Monomial { public: Monomial(NumT c = 0, int d = 0) : coeff(c), expo(d) { } NumT coefficient(void) const { return coeff; } int degree(void) const { return expo; } void assign_coefficient(const NumT c) { coeff = c; } void assign_degree(const int d) { expo = d; } bool operator==(const Monomial & m) const { return (coeff == m.coeff && expo == m.expo); } bool operator!=(const Monomial & m) const { return (coeff != m.coeff || expo != m.expo); } //NumT operator(); private: NumT coeff; int expo; }; template class Polynomial : public ZERO_T/**/ { public: Polynomial(NumberType c = 0, int d = 0) { const Monomial m(c, d); term_list.push_back(m); //creates a ZERO monomial for c=0 and d=0 number_of_terms = 1; highest_degree = d; } Polynomial(const Monomial & m) //type conversion constructor { term_list.push_back(m); number_of_terms = 1; highest_degree = m.degree(); } ~Polynomial() { } // use default destructors and list's destructor Polynomial(const Polynomial & rhs) // copy constructor : term_list(rhs.term_list), number_of_terms(rhs.number_of_terms), highest_degree(rhs.highest_degree) { } const Polynomial & operator=(const Polynomial & rhs); //copy assignment const Polynomial & operator=(const Polynomial && rhs);

Polynomial operator+=(const Monomial &m); Polynomial operator+=(const Polynomial & rhs); const Polynomial operator+ (const Monomial &m) const; const Polynomial operator+ (const Polynomial & rhs) const; Polynomial operator-=(const Monomial &m); Polynomial operator-=(const Polynomial & rhs); const Polynomial operator- (const Monomial &m) const; const Polynomial operator- (const Polynomial & rhs) const; Polynomial operator*=(const Monomial &m); Polynomial operator*=(const Polynomial & rhs); const Polynomial operator* (const Monomial &m) const; const Polynomial operator* (const Polynomial & rhs) const; const NumberType evaluate(NumberType x) const; bool operator==(const Polynomial &p) const; bool operator!=(const Polynomial &p) const; int gethighestdegree() const { return highest_degree; } void read(istream & in = cin); void print(ostream & out = cout) const; //const static Polynomial ZERO ; private: list > term_list; //sorted by decreasing degrees int number_of_terms; int highest_degree; void insert_in_poly(Polynomial & p, const Monomial & m); //helper function NumberType power(NumberType x, int n) const; }; //const Polynomial Polynomial::ZERO = Polynomial{ 0,0 }; template istream& operator>>(istream & in, Polynomial & rhs); template ostream& operator & rhs); #include "Polynomial.cpp" #endif

CS 318 Programming Project Polynomial Template Class Design and Implementation C++ Due Date: See Blackboard. Project Implementation Constraints: Name your VS 2017 C++ project: CS318PO2YourLastName o (You will be deducted points from your project score if your VS 2017 project is not named correctly.) Project Settings: Console, x86, Debug settings. What and Where to Submit: You must zip-up the ENTIRE project folder containing your Visual Studio 2017 Project. Also, any test source files and sample data must be included. If your program does not work, please include a Word or notepad file explaining what works and what doesn't work. The file should be submitted to the Project Assessment Icon on CS 318 Blackboard site. Zipped file name: CS318PO2LastName.zip. For example, if I were to turn in this project, I would name it CS318PO2Jeffrey.zip. You are to implement single-variable polynomials using the STL template class. A single-variable polynomial, px), of degree n over a numeric type, NumType, is of the form where n e non negative integers, a, e NumType, and an #0 The a,'s are called coefficients. Each ar are called monomials (also called terms). The numeric type, NumType, can be any C++built-in numeric type (short, int, long, float, double, long double) or a class type (e.g. rational, complex) that has the following defined operators: +,-, * -,-,- , +=, , , , and template class. A single-variable polynomial, px), of degree n over a numeric type, NumType, is of the form where n e non negative integers, a, e NumType, and an #0 The a,'s are called coefficients. Each ar are called monomials (also called terms). The numeric type, NumType, can be any C++built-in numeric type (short, int, long, float, double, long double) or a class type (e.g. rational, complex) that has the following defined operators: +,-, * -,-,- , +=, , , , and

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!