class polynomial
{
public:
// CONSTANT
static const int CAPACITY = 15;
// CONSTRUCTOR
polynomial(double c = 0.0, int degree = 0);
// MEMBER FUNCTIONS
void add_to_coef(double amount, int degree);
void assign_coef(double c, int degree);
void clear();
double coefficient(int degree) const;
void print();
int degree() const;
private:
// DATA MEMBERS
double coef[CAPACITY];
int largest_degree;
};
#include "poly.h"
#include <cmath>
using namespace std;
static const int CAPACITY = 15;
// Start implementing your functions here
1
Expert's answer
2012-05-24T09:14:58-0400
#pragma once #include <iostream> class polynomial { public: & //CONSTANT & static const int CAPACITY = 15; & // CONSTRUCTOR & polynomial(double c = 0.0, int degree = 0); & // MEMBER FUNCTIONS & void add_to_coef(double amount, int degree); & void assign_coef(double c, int degree); & void clear(); & double coefficient(int degree) const; & void print(); & int degree() const; private: & // DATA MEMBERS & double coef[CAPACITY]; & int largest_degree; };
#include "poly.h" #include <cmath> #include<process.h> using namespace std; polynomial::polynomial(double c , int degree ) { if (degree<CAPACITY){ largest_degree=degree; for(int i=0;i<=degree;i++) coef[i]=c; } else cout<<"Bad degree";exit(0);//because it is very important to know & //did we create element or not.
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
I was amazed on the turnaround on not only the work but the response time. There were 4-5 assignments before that began to make me wonder on the customer service aspect and not just the completion of work. This assignment and support brought light at the end of the tunnel.
Comments
Leave a comment