Create a graphical user interface program for solving the quadratic equation ax2 + bx + c = 0. The user will enter values for a, b, and c into text fields and press a “Solve” button. The program will then display a list of the roots in a text field. Your interface should look similar to the above. Use a BorderPane as the parent node of the scene. Use an HBox to hold the four labels and four text fields and another HBox to hold the “Solve” button. The unicode for a superscripted 2 is “\u00B2”.  When the user clicks the “Solve” button the program should use Double.parseDouble to parse the a, b, and c text fields. If any of these calls to parseDouble cause an exception then catch the exception and change that text field’s text to “0” (by performing setText("0") on that text field). Do not change the values in the other text fields. Your program should correctly deal with cases where a, b, and/or c are 0 -- For instance, if all three fields are 0 then the roots are all x. If a and b are 0 but c is non-zero, then there are no roots. If a is 0 but b is non-zero, then we have a line with non-zero slope, so there is exactly one root. If a is non-zero, then the number of roots depends on the so-called discriminant: b2 – 4ac. If the discriminant is positive, there are two roots. (See the first example above.) If the discriminant is 0, there is only one root – don’t display it twice. If the discriminant is negative, then there are no roots (“No x”, as above). Thanks in advance! Hopefully this is better organized.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Create a graphical user interface program for solving the quadratic equation ax2 + bx + c = 0. The user will enter values for a, b, and c into text fields and press a “Solve” button. The program will then display a list of the roots in a text field.

Your interface should look similar to the above. Use a BorderPane as the parent node of the scene. Use an HBox to hold the four labels and four text fields and another HBox to hold the “Solve” button. The unicode for a superscripted 2 is “\u00B2”. 

When the user clicks the “Solve” button the program should use Double.parseDouble to parse the a, b, and c text fields. If any of these calls to parseDouble cause an exception then catch the exception and change that text field’s text to “0” (by performing setText("0") on that text field). Do not change the values in the other text fields.


Your program should correctly deal with cases where a, b, and/or c are 0 --

For instance, if all three fields are 0 then the roots are all x.

If a and b are 0 but c is non-zero, then there are no roots.

If a is 0 but b is non-zero, then we have a line with non-zero slope, so there is exactly one root.

If a is non-zero, then the number of roots depends on the so-called discriminant: b2 – 4ac. If the discriminant is positive, there are two roots. (See the first example above.) If the discriminant is 0, there is only one root – don’t display it twice. If the discriminant is negative, then there are no roots (“No x”, as above).

Thanks in advance! Hopefully this is better organized.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Knowledge Booster
Managing System
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education