Convert the following UML class diagram into a complete, wor…
Convert the following UML class diagram into a complete, working Java class named QuadraticEquation: Requirements: Implement the class exactly as shown in the UML diagram. All data fields must be private. Provide a constructor that accepts the three coefficients a, b, and c. Implement the three methods shown: getDiscriminant(), getRoot1(), and getRoot2(). You may assume the discriminant is greater than or equal to zero (i.e., the equation has real roots). Use the quadratic formula to calculate the roots inside getRoot1() and getRoot2(). The formula for the discriminant is: discriminant = b² − 4ac The formulas for the roots are: root1 = (−b + √discriminant) / (2a) root2 = (−b − √discriminant) / (2a) Hint: Remember to use Math.sqrt() to calculate the square root. Hint: The quadratic equation formula is used to find the solutions (or roots) of a quadratic equation, which is typically expressed in the standard form: ax2+bx+c = 0 where a, b, and c are constants, and a
Read Details