0

Alright so I'm coding a Quadratic Equation Solver to help with my Math Class. However the teacher requires each calculation to be written out. I have the solver working, however I'm not sure where to start when it comes to printing each step. I know I will need to `System.out.println()`

each step. But how does Java interpret the equation? Does it do proper BEDMAS(Brackets, Exponents, Division, Multiplication, Addition, Subtraction)?

```
if(disc == 0)
{
x1 = (-b+Math.sqrt(Math.pow(b, 2)-4*a*c))/(2*a);
System.out.println("One Root Found: " + x1);
}
else if(disc > 0)
{
x1 = (-b+Math.sqrt(Math.pow(b, 2)-4*a*c))/(2*a);
x2 = (-b-Math.sqrt(Math.pow(b, 2)-4*a*c))/(2*a);
//Output Results
System.out.println("Two Roots Found: " + x1 + " or " + x2);
}
else if(disc < 0)
{
disc = (Math.pow(b, 2)-4*a*c);
double re = -b / (2 * a);
System.out.println("Root1: " + re + " + " + (Math.sqrt(-disc) / (2 * a)) + "i");
System.out.println("Root2: " + re + " - " + (Math.sqrt(-disc) / (2 * a)) + "i");
}
```

*Edited 2 Years Ago by Doogledude123*: Using inline code