Problem 1. Solve Quadratic Equations (QuadraticRoot.java) The two roots of a quadratic equation ax + bx +c = 0 can be obtained using the following formula: -b+ V- 4ac rl = 2a -b -4ac r2 2a b - 4ac is called the discriminant of the quadratic equation. If it is positive, the equation has two real roots. If it is zero, the equation has one root. If it is negative, the equation has no real roots. Write a Java class named QuadraticRoot that prompts the user to enter values for a, band c and displays the result based on the discriminant. If If the discriminant is 0 the discriminant is ngsitive dislay two roots.

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
icon
Concept explainers
Question
100%

Need answer for problem 1 only

Please provide implementation and output screenshots.

Problem 1. Solve Quadratic Equations (QuadraticRoot.java)
The two roots of a quadratic equation ax + bx +c = 0 can be obtained
using the following formula:
-b+ vb? - 4ac
rl =
2a
-b - Vb2 - 4ac
r2 =
2a
b - 4ac is called the discriminant of the quadratic equation. If it is
positive, the equation has two real roots. If it is zero, the equation has
one root. If it is negative, the equation has no real roots.
Write a Java class named QuadraticRoot that prompts the user to enter
values for a, b and c and displays the result based on the discriminant. If
the discriminant is positive, display two roots. If the discriminant is 0,
display one root. Otherwise, display "The equation has no real roots".
Outputs:
Please enter a, b, c: 1.8 3 1
The equation has two roots: -0.381966 and -2.61803
Please enter a, b, c: 1 2.8 1
The equation has one root: -1
Please enter a, b, c: 1 2 3
The equation has no real roots
Problem 2. Random Month (RandomMonth.java)
Description
Write a Java class named RandomMonth that randomly generates an
integer between 1 and 12, and displays the English month name
January, February, March, ., December for the number 1, 2, 3, 12
accordingly.
You are required to use the switch statement to do this job.
Outputs:
The random number generated is 7
The corresponding month is July.
The random number generate is 12
The corresponding month is December
Transcribed Image Text:Problem 1. Solve Quadratic Equations (QuadraticRoot.java) The two roots of a quadratic equation ax + bx +c = 0 can be obtained using the following formula: -b+ vb? - 4ac rl = 2a -b - Vb2 - 4ac r2 = 2a b - 4ac is called the discriminant of the quadratic equation. If it is positive, the equation has two real roots. If it is zero, the equation has one root. If it is negative, the equation has no real roots. Write a Java class named QuadraticRoot that prompts the user to enter values for a, b and c and displays the result based on the discriminant. If the discriminant is positive, display two roots. If the discriminant is 0, display one root. Otherwise, display "The equation has no real roots". Outputs: Please enter a, b, c: 1.8 3 1 The equation has two roots: -0.381966 and -2.61803 Please enter a, b, c: 1 2.8 1 The equation has one root: -1 Please enter a, b, c: 1 2 3 The equation has no real roots Problem 2. Random Month (RandomMonth.java) Description Write a Java class named RandomMonth that randomly generates an integer between 1 and 12, and displays the English month name January, February, March, ., December for the number 1, 2, 3, 12 accordingly. You are required to use the switch statement to do this job. Outputs: The random number generated is 7 The corresponding month is July. The random number generate is 12 The corresponding month is December
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Design of User Interface
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