Question: Question 4: Provide at least 4 test cases. Prompt the user to input 3 doubles, a, b and c . Which will represent the coefficients
Question 4: Provide at least 4 test cases.
Prompt the user to input 3 doubles, a, b and c. Which will represent the coefficients in the quadratic equation ax2 + bx + c = 0. Print out the solutions (if any) of the quadratic equation. If no root exists (this happens if a == 0, or b2 <4ac) print the message No real root.
| Sample input/ user entries shown in red | Corresponding output |
| Enter a, b and c which represent the coefficients in the quadratic equation ax^2 + bx + c = 0 : 1 0 -8 | Root1 is 2.828427 Root2 is -2.828422 |
| Enter a, b and c which represent the coefficients in the quadratic equation ax^2 + bx + c = 0 : 0 3 5 | No real root |
| Enter a, b and c which represent the coefficients in the quadratic equation ax^2 + bx + c = 0 : 1 5 -5 | Root1 is 0.854101 Root2 is -5.854101 |
| Test # | Valid / Invalid Data | Description of test | Input Value | Actual Output | Test Pass / Fail |
| 1 | Valid | ||||
| 2 | Valid | ||||
| 3 | Valid | ||||
| 4 | Valid |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
