Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

loop program with java Explanation: 1. Start with a range of numbers from 0 to 26. 2. Calculate the middlemost number and square it. For

image text in transcribedloop program with java

Explanation: 1. Start with a range of numbers from 0 to 26.

2. Calculate the middlemost number and square it. For the first iteration, we found 13, which squares to 169.

3. Compare the squared number to 26.00. 169 is greater than 26.00, so we will look for another number that is less than 13, but bigger than 0. If the square were larger, we would look at numbers between 13 and 26.

4. Repeat steps 1 through 3 until we find a number that has a square of about 26.00 when rounded. Note that the answer is not exactly the square root of 26: this is only an estimate precise to two decimal places. Reducing the precision of the result from 5.098755 to 5.10 may also change the accuracy of your result. For the purpose of this assignment, this is okay. Just don't use this algorithm for your finances. You should model the functionality of your program on the one shown using the algorithm discussed above. **NOTE: You may NOT use any pre-existing square root functions for this task (e.g. Math.sqrt or Math.pow).

An example run of the program is below. You should model the functionality of your program on the one shown using the algorithm discussed above. Enter a positive number to find th square root of type quit to exit] Enter a positive number Enter a positive number to find th square root of type quit to exit] 26 Enter the precision of the estimator (number of digits after decimal point): Square Root of 26 5.10 Enter a positive number to find th square root of type quit to exit] 26 Enter the precision of the estimator (number of digits after decimal point): Square Root of 26: 5.099 Enter a positive number to find th square root of type quit to exit] quit

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

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions