Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA: Write a program that prompts the user for a value (in double form) greater than 10 as input and loops (using WHILE loop)

IN JAVA:

Write a program that prompts the user for a value (in double form) greater than 10 as input and loops (using WHILE loop) until the user enters a valid value. Once the user has entered a valid value, create another WHILE loop that computes the square root of the value (each iteration) until the result is smaller than 1.01. The program should output the square-root result each iteration (format the output to 3 decimals, as seen in the example), and then, after the loop, output how many times the square root operation was performed.

Sample Input/Output:

The following below shows an example of what your console interaction should look like for a given example. Your output should match the output here exactly. Text that is underlined and green represents text that is input to the program by the user. Please enter a number greater than 10: 4 Please enter a number greater than 10: 10 Please enter a number greater than 10: 15 The square root of 15.000 is 3.873 The square root of 3.873 is 1.968 The square root of 1.968 is 1.403 The square root of 1.403 is 1.184 The square root of 1.184 is 1.088 The square root of 1.088 is 1.043 The square root of 1.043 is 1.021 The square root of 1.021 is 1.011 The square root of 1.011 is 1.005 You performed 9 square root operations.

Thank you so much!

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

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

Explain in detail the concept of apportionment

Answered: 1 week ago

Question

3. Contrast relational contexts in organizations

Answered: 1 week ago

Question

2. Describe ways in which organizational culture is communicated

Answered: 1 week ago