# Templates in C++ / Polynomials

You need to complete Exercise 5 and create different templates/typedefs/classes. For this you'll need to take a quick look at Exercise 4. It's not a big project, you should be able to finish it in 1-2 hours.

## Get Help With a similar task to - Templates in C++ / Polynomials

Exercise 5: Generic Polynomials by Templates The goal of this exercise is to implement multivariate polynomials with generic coefficient domains, as in Exercise 4. However, in contrast to Exercise 4, the implementation shall now be based on a class template; thus genericity is achieved by parametric polymorphism rather than by inheritance. In detail, your tasks are as follows: 1. First implement a class template template<class R> class Polynomial such that the objects of the resulting class represent multivariate polynomials over the coefficient domain R . The parameter R is assumed to denote a class that provides the same operations as those in Exercise 4. The representation and functionality of class template Polynomial is analogous to that of the class of Exercise 4. However, since the class resulting from the instantiation of this template is is not designed for inheritance with overriding, the operations need not be virtual. 2. Next, use class template Polynomial and class Integer (you may use the same class as in the previous exercise) to create by the definition typedef Polynomial<Integer> IntPoly; a type IntPoly that implement multivariate polynomials with integer coefficients. This class shall have the same functionality as the corresponding class of Exercise 4. Test this type in the same way as in Exercise 4. 3. Now also create a class Rational class Rational: public Ring { public: // rational with value n/m (default 0/1) Rational(long n=0, long m=1); }; that implements rational numbers as pairs of long values with the same operations as provided by class Integer. Create by the definition typedef Polynomial<Rational> RatPoly; a type RatPoly that implement multivariate polynomials with rational coefficients. Also test this class comprehensively. 2

## Related Questions

Similar orders to Templates in C++ / Polynomials
34
Views
0
Build a Simple Text Adventure Game for Beginner C++
I need a small, simple text adventure game made for my Intro to C++ class. The assignment is due at 11:30PM tonight, so it is urgent. There are a few requirements listed in the attached photo, but overall the expectation is low because it is an intro class...
44
Views
0
Build a simple text adventure game
Assignment Prompt: Build A Simple Text Adventure Game For your final project, your instructor would like to see your creativity in coding! Your instructor has tasked you with creating a text adventure game ( they were really popular in the 1980's - ht...
34
Views
0
multiple c++ programs with screen shots
Please put your name on line 4, compile it, and show the following program's output (screen capture). 1.// This program is used by General Crates, Inc. to calculate 2.// the volume, cost, customer charge, and profit of any crate 3// to be built, when g...
27
Views
0