Question: IN java Design a class called QuadraticEquation for a quadratic equation ax2+ bx + c= 0 x = ?b -+ ?(b 2 ? 4ac)/2a Here

IN java

Design a class called QuadraticEquation for a quadratic equation

ax2+ bx + c= 0

x = ?b -+ ?(b2 ? 4ac)/2a

Here is the UML for the class:

Quadratic Equation

- double a

-double b

-double c

QuadraticEquation(double a, double b, double c)

+getA(): double

+getB(): double

+getC(): double

+setA(double a): void

+setB(double b): void

+setC(double c):void

+getDiscriminant(): double// returns the discriminant, returns zero if it is negative

+getRoot1(): double//return zero if the discriminant is negative

+getRoot2(): double//return zero if the discriminant is negative.

+equals(QuadraticEquation e): boolean

+getE

quation(): String. This method needs to return the equation in the form of

: example:

3x2+ 4x + 7= 0

+toString(): String

2.Create a text file using notepad to include the coefficients a, b, and c for 10 different equations

3.Create a driver class to do the following:

a. Declare an array of QuadraticEquation with the size 10

b. Create a method called fillArray(QuadraticEquation equations). This method reads the info for each equation from a file, then creates an object of QuadraticEquation, then stores it in the array

c. Write the method called get result (QuadraticEquation equation) that for(int i =0 ; i< equations.length; i++)

{

1.Calls the method getEquation to display the equation for each object in the array

2. Call the method getDiscriminant for each equation in the array

3. Call the method getRoot1 for each equation in the array

4. Call the method getRoot2 for each equation in the array

5. Display the result for each object in the arra

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!