Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Basic Java please answer for QuadraticRoots.java program Let all numeric variables be of the double type. For computing square roots, you can use the

Using Basic Java please answer for QuadraticRoots.java program

image text in transcribedimage text in transcribed

Let all numeric variables be of the double type. For computing square roots, you can use the following method call: Math.sqrt(some numeric value) You can use this method call whereever you would use a double literal or variable, and it can take as it's parameter a numeric value -- a literal, a variable, an expression, etc. The following are some valid lines of Java code that illustrate how you can use the method in your own code: double doubleVarl = 3.0; double doubleVar2 = Math.sqrt(9.0); // result is 3.0, same as previous line double doubleVar3 = 13.0 - 4.0; double doubleVar4 = 13.0 - Math.sqrt (16.0); // result is 9.0, same as previous line double doubleVar5 = Math.sqrt (doublevarl * doublevar3 + doubleVar4 / (doublevar4 - doubleVar2)); There may be cases where you find it helpful to compute an intermediate result and store it in a variable, as a way of making calculations easier. Do not use parentheses in your expressions unless necessary to force the order of operations. 3. QuadraticRoots.java Write code to compute the two roots of a quadratic equation of the form ax? + bx+c=0 whose coefficients a, b, and c are -3, -7, and 5, respectively. Root 1 formula: -b + V62-4ac 2a Root 2 formula: -6 - V02-4ac 2a To do this, you will need variables for a, b, c, the first root, and the second root. Use println statements to announce the values of the coefficients -- and resulting roots, in place of the blanks. Use string concatenation with the variables. Coefficient A is -3.0. Coefficient bis -7.0. Coefficient cis 5.0. Root #1 is Root #2 is Program output, when the programs are run, will probably look something like these: Side A is 5.0 centimeters. Side B is 6.0 centimeters. Side Cis 7.0 centimeters. The triangle is square centimeters. Radius is 7.0 centimeters. Height is 21.0 centimeters. The cylinder's surface area is square centimeters. Coefficient A is -3.0. Coefficient bis -7.0. Coefficient cis 5.0. Root #1 is Root #2 is

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions