Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please complet the area in the box: //Purpose: This program displays the number

ID: 3617874 • Letter: P

Question

please complet the area in the box: //Purpose:  This program displays the number of real roots for a quadratic equation.
//        The program continues to read in floating-point values for A, B, and C
//        until a non-negative discriminant  (B2 - 4AC) is found or the end of file is reached.
//include files...
#include <iostream>
#include <string>
using namespace std;
void printMessage(float);
float computeDiscriminant(float, float, float);
int main()
{
    float A, B, C;
    float discriminant=0;
    // complete the following code so that the program continues to read in
    // floating-point values for A, B, and C until a non-negative
    // discriminant (B2 - 4AC) is found or the end of file is reached.

    do
// use a do-while loop(started above) to read in floating-point valuesfor A, B and C// until a non-negative discriminant is found or reach the end of file.cout << "Enter three coefficients for the quadratic equations:";cin >> A >> B >> C;// compute the discriminant using the computeDiscriminant function

    printMessage(discriminant);
    return 0;
}
void printMessage(float disc)
{
    if(disc == 0)
        cout << "There is one root. ";
    else if (disc > 0)
        cout << "There are two roots. ";
    else
        cout << "There is no root. ";
}
float computeDiscriminant(float a, float b, float c)
{
    return b*b-4*a*c;
} please complet the area in the box: //Purpose:  This program displays the number of real roots for a quadratic equation.
//        The program continues to read in floating-point values for A, B, and C
//        until a non-negative discriminant  (B2 - 4AC) is found or the end of file is reached.
//include files...
#include <iostream>
#include <string>
using namespace std;
void printMessage(float);
float computeDiscriminant(float, float, float);
int main()
{
    float A, B, C;
    float discriminant=0;
    // complete the following code so that the program continues to read in
    // floating-point values for A, B, and C until a non-negative
    // discriminant (B2 - 4AC) is found or the end of file is reached.

    do
// use a do-while loop(started above) to read in floating-point valuesfor A, B and C// until a non-negative discriminant is found or reach the end of file.cout << "Enter three coefficients for the quadratic equations:";cin >> A >> B >> C;// compute the discriminant using the computeDiscriminant function

    printMessage(discriminant);
    return 0;
}
void printMessage(float disc)
{
    if(disc == 0)
        cout << "There is one root. ";
    else if (disc > 0)
        cout << "There are two roots. ";
    else
        cout << "There is no root. ";
}
float computeDiscriminant(float a, float b, float c)
{
    return b*b-4*a*c;
}

Explanation / Answer

   return 0;
}

void
printMessage(float disc)
{
    if(disc == 0)
        cout << "There is one root. ";
    else if (disc > 0)
        cout << "There are two roots. ";
    else
        cout << "There is no root. ";
}
float computeDiscriminant(float a, float b, float c)
{
    return b*b-4*a*c;
}