// // preliminary version of function to calculate and print // roots of quadratic equation // a*x*x + b*x + c = 0 // prints message if no real (non-imaginary) roots // def roots(a : Double, b : Double, c : Double) { println("a = " + a + ", b = " + b + ", c = " + c) if ((b*b - 4*a*c) >= 0) { val root1 = (-b + math.sqrt(b*b - 4*a*c))/(2*a) val root2 = (-b - math.sqrt(b*b - 4*a*c))/(2*a) println("roots " + root1 + ", " + root2) } else { println("No real roots") } }