Question: C++ Please! Exercise 2: Quadratic Equation (This is essentially Exercise P9.20 of the book) Write a program quadratic.cpp that reimplements the QuadraticEquation class. This program

C++ Please!

C++ Please! Exercise 2: Quadratic Equation (This is essentially Exercise P9.20 of

Exercise 2: Quadratic Equation (This is essentially Exercise P9.20 of the book) Write a program quadratic.cpp that reimplements the QuadraticEquation class. This program will print all real solutions to the quadratic equation ar? + bx + c = 0, assuming a 70. Read in a, b, c, and use the quadratic formula. If the discriminant b2 - 4ac is negative, display a message stating that there are no real solutions. Implement a class QuadraticEquation whose constructor receives the coefficients a, b, c of the quadratic equation. Supply member functions get solution and get solution that get the solutions, using the quadratic formula, or 0 if no solution exists. The get_solutioni function should return the smaller of the two solutions. Supply a function bool has solutions() const that returns false if the discriminant is negative. Please have the output formatted exactly like the following examples: (the red is user input) Enter a coefficient: 1.2 Enter b coefficient: 8.3 Enter c coefficient: 7.6 Solution 1: -5.83041 Solution 2: -1.08626 Enter a coefficient: 2 Enter b coefficient: 5 Enter C coefficient : 5 This has: No real solutions Note: Make sure that if the quadratic equation has two unique solutions, then Solution 1 is the smaller of the two solutions. Assume that a #0. Don't worry about the number of decimal places, just keep the defaults. If a quadratic equation only has one solution, then just print it both times as solution 1 and solution 2. Note on formatting: We'll stress again - please have the formatting like the above examples. Make sure to have colons. . No invalid inputs: You do NOT have to worry about the user giving invalid inputs like characters, really large numbers, etc. . You may not use stdafx.h

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!