Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use Java Problem 1. Solve Quadratic Equations (QuadraticRoot.java) The two roots of a quadratic equation ax? +bx+c = 0 can be obtained using the

Please use Java
image text in transcribed
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 + b2 - 4ac r1 = 2a -b-b2 - 4ac r2 = 2a b2 - 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 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.0 31 The equation has two roots: 6.381966 and -2.61883 Please enter a, b, c: 1 2.0 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 Random Month 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions