Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Quadratic {
- public static double root1(double a, double b, double c) {
- double determinant = determinant(a, b, c);
- return (-b + Math.sqrt(determinant)) / (2*a);
- }
- public static double root2(int a, int b, int c) {
- double determinant = determinant(a, b, c);
- return (-b - Math.sqrt(determinant)) / (2*a);
- }
- private static double determinant(double a, double b, double c) {
- return b*b - 4*a*c;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement