Question: I am writting a c++ program. A one-variable quadratic expression is an arithmetic expression of the form ax^2+bx+c, where a,b, and cc are some fixed
I am writting a c++ program. A one-variable quadratic expression is an arithmetic expression of the form ax^2+bx+c, where a,b, and cc are some fixed numbers (called the coefficients) and x is a variable that can take on different vaues. Specfy, design, and implement a class that can store information about a quadratic expression; The default constructor should set all three coefficients to zero, and another member function should allow you to change these coefficients. There should be constant member functions to retreve the current values of the coefficients. There should also be a member function to allow you to "evaluate" the quadratice expression at particular value of x(i.e. the function has one paramter x, and returns the value of the expression ax^2+bx+c). Also overloa the following operators ( as non member functions) to perform these indicated operations: quadratic operator+ ( const quadratic& q1, const quadratic& q2 ); // Postcondition : The return value is the quadratic expression obtained by adding q1 and 12. For example, ther c coefficient of the //return vvalue is the sum of q1's c coefficient and q2's c coefficient. quadratic operator *( double r, const quadratic& q ); //Post condition: The return a value is the quadratic expression obtained by multiplying each of q's coefficients by the number r. Notice that the left argument of the overloaded operator * is a double number (rather than a quadratic expression). This allows expression such as 3.14* q, where q us a quadratic expression.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
