Bifalgorithm post · Computer science one · Computing Quadratic Roots
What is 26?
What is 26? (Computer science one · Computing Quadratic Roots) — "26. Basics 26.6.2. Computing Quadratic Roots Some programs require the user to enter multiple…
Ideas in this flowchart
- Computing quadratic roots with a program
- The program uses a main() method as its basic structure.
- The user enters the coefficients a, b, and c of ax² + bx + c.
- The prompt-and-input process is repeated for a, b, and c.
- Variables are needed for a, b, c and the two roots.
- The roots are computed with the quadratic formula.
- The formula must be written to preserve the correct order of operations.
- Math.sqrt() supplies the square-root operation.
- The program prints the computed roots with System.out.printf().
- The complete interactive program appears in Code Sample 26.4.
- Alternatively, all three inputs can be supplied as command-line arguments.
- Command-line arguments must be converted to floating-point numbers.