Question: Prompt the user for 3 numbers a, b, and c as part of the quadratic equation ax2 + bx + c = 0. Use the

Prompt the user for 3 numbers a, b, and c as part of the quadratic equation ax2 + bx + c = 0. Use the quadratic equation formula to determine if there are no real roots, one real root, or two real roots. Your main block should call a method with the following signature:

int SolveQuadraticEq(double a, double b, double c, double [ ] roots)

Your method should return the number of real roots. If there is one root it will be returned in index 0 of the array roots. If there are two root they will both be returned int he array roots. The array array roots will be declared in your main block as:

double [] roots = new double[2];

Remember that a divide by 0.0 is undefined in a computer. If a = 0 this then we are no longer solving a quadratice equation. Also remember the square root of a negative number is undefined in a computer.

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!