Write a program that solves quadratic equations of the form , where   The values A, B, and C will be real numbers (doubles) that you will request from the user.  The equation below is what is used to solve for .  Remember, there will be two solutions for x (not necessarily distinct).  No loops are necessary, so don’t include any.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 30PE
icon
Related questions
Question

QuadraticAA.java

Write a program that solves quadratic equations of the form , where   The values A, B, and C will be real numbers (doubles) that you will request from the user.  The equation below is what is used to solve for .  Remember, there will be two solutions for x (not necessarily distinct).  No loops are necessary, so don’t include any.

To find the two solutions for this equation, you will use the quadratic formula:

 

Remember that it must be solved for both the  and  :

 

You will ask the user to input a value for A, B, and C (in that order, using those same letters), then you will use those values to find the two values of x as above.  Your output MUST then display the original quadratic equation back to the user with their coefficients in place, and then output the two results.  We will assume that the user will not put zero for A.

*Format ALL OUTPUT VALUES (including the equation) to have only two decimal places. 

There is a test case below.  Your program should run the test case exactly as it appears below, and should work on any other case in general.

Find a quadratic calculator online to double-check multiple sets of values.

Output Example (User input is marked with >>>. Everything else is what you print to the screen.)

This program will find the solutions for equations of the form Ax^2 + Bx + C = 0 for the variable x. Please enter three coefficients in order of A, B, and C.  (A cannot be zero.)

>>>3.0

>>>5.0

>>>-2.0

 

You have entered the equation 3.00x^2 + 5.00x + -2.00 = 0

The solutions are:

x = 0.33

x = -2.00

in java

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr