Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem b ( PA3b.java ) Write a program that solves a quadratic equation of the

ID: 3755635 • Letter: P

Question

Problem b (PA3b.java)

Write a program that solves a quadratic equation of the form:

Specifically, the user will input the values of a, b, and c. Your program must then calculate and output the

roots of the equation, following these rules.

First, calculate the discriminant:

• If the discriminant is negative, the roots are imaginary. Print out a message informing the user of

this and stop the program. For example:

Enter a b c: 1 1 4

Roots: imaginary

• If the discriminant is exactly zero, there is one root. Inform the user of this one root: . You

must provide exactly two decimal places in your response, rounding as necessary. For example:

Enter a b c: 1 4 4

Root: -2.00

• If the discriminant is positive, there are two roots. The values of the roots are: !"! #$%&'$($)*)+

,* and

–". #$%&'$($)*)+

,* . Please print the roots in an increasing order (i.e. the smaller root first, followed

by the larger). You must provide exactly two decimal places in your response, rounding as

necessary. For example:

Enter a b c: 1 6 5

Roots: -5.00, -1.00

Note that the JUnit tests, and grading, will be very picky about exact spacing, spelling, capitalization, and

number formatting.

ax2 + bx + c = 0

d = b2 _ 4ac

_b/2a

Explanation / Answer

JAVA CODE

Output is as expected

Please comment for any further assistance

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote