Question: #include using namespace std; int main() { double a, b, c; //get values for a, b, c cout < < Enter a, b, c respectively:

#include  using namespace std; int main() { double a, b, c; //get values for a, b, c cout << "Enter a, b, c respectively: "; cin >> a >> b >> c; if (a == 0) { //first order equation cout << "This is a first order equation, solution = " << -c / b << endl; } else { double D = pow(b, 2) - 4 * a * c; if (D > 0) { double x1 = (-b + sqrt(D)) / (2 * a); double x2 = (-b - sqrt(D)) / (2 * a); cout << "The equation had two distinct solutions: X1 = " << x1 << " X2 = " << x2 << endl; } else if (D == 0) { double x = -b / (2 * a); cout << "There is one double solution: " << x << endl; } else { cout << "There is no real solutions "; } } return 0; }

Modify the code above to implement it using classes.

Your class should have three double private member variables and a method solve() that will

display the solutions to the equation.

thank you so much.

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!