Question: on e) and implement code) a class (name it rogram 1: Design (pse uadraticEquation) that represents a quadratic equation lass defines the following variables and
on e) and implement code) a class (name it rogram 1: Design (pse uadraticEquation) that represents a quadratic equation lass defines the following variables and methods: s the following variables andutadratic equation of the form of ax2+ bx+x o Private data field a, b, and c that represent three coefficients. . A constructor for the arguments for a, b, and c . Three get methods for a, b, and c. . Method getDiscriminant returns the discriminant value, 5. Method getRoot1 returns first root if the discrimi which is disc b2-4ac. inant is not negative. First root is defined as R1 = (-b + SquareRoot (disc) ) 1 2a 6. Method getRoot2 0 returns second root if the discriminant is not negative. defined as R2 = (-b-SquareRoot (disc) ) 1 2a ned. Note that if the discriminant values is negative, the roots are Undefi Write a test program (name it testEquation) to create objects and test the class Organized your output following these sample runs. methods. Sample run 1 for 3x2+ 8x+4 c=4 Root 1 0.6666666666666666 Root 2 2.0 Sample run 2 for 3x2+ 4x8 a=3 b=4 c=8 Root 1 is Undefined Root 2 is Undefined Sample run 3 for 2x2+ 8x + 2: a2 Root 1-0.2679491924311228 Root 2-3.732050807568877
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
