Question: Program Specifications. Develop a program using the Eclipse or Visual Studio Code IDE to calculate the roots of a second-order polynomial. A second-order polynomial is

Program Specifications. Develop a program using the Eclipse or Visual Studio Code IDE to calculate the roots of a second-order polynomial. A second-order polynomial is of the form ax2+bx+c=0. Your program should read in real (i.e., floating point) values for coefficients a, b, and c then compute and print the roots. Recall that the roots are real or complex values of x that satisfy the polynomial.

Different cases

1. If both a = 0 and b = 0, the polynomial is considered degenerate. In this case, display the message "Polynomial is degenerate."

2. If a=0 but b0, the polynomial has one root x= -c / b. In this case, display the message "Polynomial has one real root x = " followed by the numeric root value.

3. If a0, the polynomial has two roots, x1,2=1 / 2a(bb24ac).

Recall from algebra, if the discriminant b24ac=0 the two roots are real (e.g., not complex numbers) and equal. In this case, display the message "Polynomial has two real and equal roots = " followed by the numeric root value. On the other hand, if the discriminant b24ac<0 the two roots are complex. In this case, display the message "Polynomial has two complex roots = " followed by the two root values printed in complex notation. Finally, if the discriminant b24ac>0 the two roots are both real. In this case, display the message "Polynomial has two real roots = " followed by the two root values.

Examples

If the input is:

1 2 3 your output should be: Polynomial has two complex roots = -1.000000+i1.414214 and -1.000000-i1.414214 If the input is: 1 5 6 your output should be: Polynomial has two real roots = -2.000000 and -3.000000 If the input is: 1 2 1 your output should be: Polynomial has two real and equal roots = -1.000000 If the input is: 0 2 3 your output should be: Polynomial has one real root x = -1.500000

IN C PROGRAMMING PLEASE

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!