Question
The quadratic formula gives solutions to quadratic polynomials of the form ax2 + bx + c. The quadratic formula is defined as x = -b
The quadratic formula gives solutions to quadratic polynomials of the form ax2 + bx + c. The quadratic formula is defined as x = -b +/- (b2 - 4ac) / 2a, where +/- means that there are actually two versions: x = -b + (b2 - 4ac) / 2a and x = -b - (b2 - 4ac) / 2a Write the code that reads three floating point inputs for a, b, and c and then calculates and displays the plus and minus solutions. For example, given the values a = 1, b = 0, and c = -4, the program should display 2.0 -2.0 Given the values a = 1, b = 0, c = 4, the program should display NaN NaN Give the values a = 1 , b = 2, c = 1, the program should display 2.0 2.0
Hints: Add import java.lang.Math; and then use the sqrt() method. For squaring, you might use the pow() method with a second parameter of 2.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started