Question: Test 3(20 points) Classes and Objects. Design a class named QuadraticEquation for a quadratic equation ax2+bx+c=0. The class contains: - (3 points)Private data fields a,
Test 3(20 points) Classes and Objects. Design a class named QuadraticEquation for a quadratic equation ax2+bx+c=0. The class contains: - (3 points)Private data fields a, b, and c that represent three coefficients. - (4 points)A constructor for the arguments for a,b, and c. - (3 points)Three getter methods for a, b, and c. - (4 points)A method named getDiscriminant() that returns the discriminant, which is b24ac. (6 points)The method named getRootl() and getRoot2() for returning two roots of the equation. These methods are useful only if the discriminant is nonnegative. Let this methods return 0 if the discriminant is negative. r1=2ab+b24acr2=2abb24ac
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
