write a method called quadratic that solves quadratic equations and prints their roots. recall that a quadratic equation is a polynomial equation in terms of a variable x of the form ax^2 + bx + c = 0. The formula for solving a quadratic equation is:
x= -b + or - the square root of b^2 - 4ac/2a
Please use the example where a =1, b= -7, c=10
so the roots are 5 and 2.
i am unsure of how to program this can anyone figure it out??![]()


LinkBack URL
About LinkBacks
Reply With Quote
Also, it's not possible for a method to return 2 values, so I removed the helper method. Don't know if you have to handle imaginary roots, I left that out. I would also highly recommend using doubles when computing quadratic roots
