Solves a quadratic equation using basic formula method