Question: Problem b (PA2b.java) Write a program that solves a quadratic equation of the form: ar? + br+c=0 Specifically, the user will input the values of

 Problem b (PA2b.java) Write a program that solves a quadratic equation

Problem b (PA2b.java) Write a program that solves a quadratic equation of the form: ar? + br+c=0 Specifically, the user will input the values of a, b, and e. Your program must then calculate and output the roots of the equation, following these rules. First, calculate the discriminant: d=b2 - 4ac 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: 114 Roots: imaginary COMP1000- Programming Assignment 2 If the discriminant is exactly zero, there is one root. Inform the user of this one root:--b/20. You must provide exactly two decimal places in your response, rounding as necessary. For example: Enter a b c: 1 4 4 Root: -2.ee If the discriminant is positive, there are two roots and Inform the user of the 2a value of the roots in increasing order of value (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: 165 Roots: -5.00 -1.ee Note that the JUnit tests, and grading, will be very picky about exact spacing, spelling, capitalization, and number formatting

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!