Question: JAVA LANGUAGE: Design a class named QuadraticEquation for a quadratic equation ax+bx+eo The class contains Private data fields a, b, and e that represent three
JAVA LANGUAGE:
Design a class named QuadraticEquation for a quadratic equation ax+bx+eo The class contains Private data fields a, b, and e that represent three coefficients Three getter methods for a, b, and e. The methods named getRootl0 and getRoot20 for retuming two roots of the equation .A constructor with the arguments for a, b, and e .A method named getDiscriminant that returns the discriminant, which is b'- 4ac. 4ac - 4ac and - These methods are useful only if the discriminant is nonnegative. Let these methods retum 0 if the discriminant is negative. Draw the UML diagram for the class then implement the class. Write a test program that prompts the user to enter values for a, b, and e and displays the result based on the discriminant. If the diseriminant is positive, display the two roots. If the discriminant is 0, display the one root. Otherwise, display "The equation has no roots." Here are some sample runs: Enter a, b, c: 1.0 3 1 The equation has two roots -0.381966 and -2.61803 Enter a, b, c: 1 2.0 1 The equation has one root 1.0 Enter a, b, c: 1 2 3 The equation has no real roots
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
