Clarissa M.

asked • 12/07/20

NEED HELP ASAP JAVA CODE

Quadratic equations ax2 + bx + c = 0. Class consists of:

  1. private data fields a, b,c that represent 3 coeffiecients
  2. no org constructor
  3. 3 arg constructor
  4. 3 getter methods for a,b,c
  5. a method name GetDiscriminate() that returns the discriminant - b2-4ac
  6. method names getRoot1() and getROOT2() for returning 2 roots of the equations

EQUATIONS: r1 = -b + squareroot discriminant

—————————————

2a


r2 = -b + squareroot discriminant

—————————————

2a

Both method should return as 0 if discriminant is negative

  1. use Exception handling in all the setter methods
  2. method toString() - to represent the state of the object. If discriminant is positive, display two roots. If 0 then 1 root. if not, then "the equation has no real roots"
  3. method equals() - to compare 2 objects for equality
  4. write a client that prompts the user iteratively to enter values for a,b,c and display results on discriminant. program should end if the user enters 0 for a.

Patrick B.

Hi Clarissa . I uploaded the source code for you under this link in the RESOURCES section
Report

12/08/20

Patrick B.

You have to rename the text file
Report

12/08/20

Patrick B.

It traps A equal to zero and calculated imaginary/complex roots
Report

12/08/20

1 Expert Answer

By:

Patrick B. answered • 12/07/20

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.