homework help time!
I am taking a quadratic expression, where y=ax^2 + bx + c
with a
,b
,c
are constants and x
is a variable. Here is my class:
class quadratic {
public:
double evaluate(const double x);
void getCoefficients (double &A, double &B, double &C);
void setCoefficients (const double A, const double B, const double C);
private:
double a;
double b;
double c;
};
I am to create TWO constructors for the class so that the following is legal
quadratic y1 = quadratic(1.0, -5.0, 7.0);
quadratic y2 = quadratic(-3.0, -2.0, 10.0);
quadratic y3;
The default constructor should be set to zero while the parameters in the second constructor indicate initial values for the coefficients.
Here is how I believe I should do that:
quadratic() //default values
{
double A, double B, double C = 0.0;
}
quadratic(double A, double B, double C) //initial values
{
double A = double a;
double B = double b;
double C = double c;
}
However I'm not fully understanding how to set this up and would appreciate any gurus help in figuring this out.