Question: I want a test program in a file named test_polynom.cc to thoroughly test the member functions of the class Polynom provided below. See the pic

I want a test program in a file named test_polynom.cc to thoroughly test the member functions

of the class Polynom provided below. See the pic If you want to know what the class is about.

I want a test program in a file named test_polynom.cc to thoroughly

Here is the Polynom.cc file that needs a testing file:

#include "Polynom.h" #include  #include  using namespace std; Polynom::Polynom(){ P.clear() ; // clear the polynomial } Polynom::Polynom(const vector& coeff){ for(int i=0;i=0 and k=0 and k P; while(isspace(ch) == false) { ch = in.peek(); if(ch == '+') { in.ignore(); in >> coefficient; } else if(ch == '-') { in.ignore(); in >> coefficient; coefficient = coefficient * (-1); } else { in >> coefficient; } P.push_back(coefficient); } p = Polynom(P); return in; } 

In this assignment you wl define, implement, and test a C class called Polynom to represent and use polynomials A polynomial function of independent variable r can be written as The highest power of variable r that occurs in the polynomial (in this case n) is called the degree of the polynoial. The quantities an, ao are constants known as coefficients. In this assignment coefficients are int type and can be positive, negative, or 0 A basic operation for polynomials is to evaluate a polynomial at a specific value of r. For example, we can evaluate the quadratic polynomial q(), q(z) =12 + 51 + 6 for for = 2, by writing the polynomial in the following form. q(z) = ((z + 5)| + 6) and then substituting r = 2 to obtain, g(2) = ((2 + 5)2 + 6) = ((72 + 6)-(14 + 6)-20 We can add two polynomials and subtract one from the other. Examples are shown below p(z) + q(z) = (3 + 0)r' + (2 + 1)z? + (1 +5)| + (16+6) 33 + 312 + 6x+ 22 = A simple way to represent a polynomial object of degree n is to use a vector of length n+1 to store the coefficients. For example, the polynomials p and q can be represented by vectors of length 4 and 3, respectively p 3 2 1 16, q 1 5 6] It is possible that some of the coefficients in a polynomial are 0. Consider the polynomial r(r) 5? + 24 + 19 where the largest power of r is 9 so that we need a vector of length 10 to store the polynomial r 5 0 0 0 0 2 0 0 0 6 This assignment asks you to implement the functions that appear in Polynom.cc according to the specification provided in the description given above. In this assignment you wl define, implement, and test a C class called Polynom to represent and use polynomials A polynomial function of independent variable r can be written as The highest power of variable r that occurs in the polynomial (in this case n) is called the degree of the polynoial. The quantities an, ao are constants known as coefficients. In this assignment coefficients are int type and can be positive, negative, or 0 A basic operation for polynomials is to evaluate a polynomial at a specific value of r. For example, we can evaluate the quadratic polynomial q(), q(z) =12 + 51 + 6 for for = 2, by writing the polynomial in the following form. q(z) = ((z + 5)| + 6) and then substituting r = 2 to obtain, g(2) = ((2 + 5)2 + 6) = ((72 + 6)-(14 + 6)-20 We can add two polynomials and subtract one from the other. Examples are shown below p(z) + q(z) = (3 + 0)r' + (2 + 1)z? + (1 +5)| + (16+6) 33 + 312 + 6x+ 22 = A simple way to represent a polynomial object of degree n is to use a vector of length n+1 to store the coefficients. For example, the polynomials p and q can be represented by vectors of length 4 and 3, respectively p 3 2 1 16, q 1 5 6] It is possible that some of the coefficients in a polynomial are 0. Consider the polynomial r(r) 5? + 24 + 19 where the largest power of r is 9 so that we need a vector of length 10 to store the polynomial r 5 0 0 0 0 2 0 0 0 6 This assignment asks you to implement the functions that appear in Polynom.cc according to the specification provided in the description given above

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!