Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This must be a Java program that: Correctly compiles under the UNIX command line. When run, reads a a double-precision floating-point number (type double) number

This must be a Java program that:

Correctly compiles under the UNIX command line.

When run, reads a a double-precision floating-point number (type double) number and outputs its square root, to the nearest integer rounded down, as an integer (no decimal places) to standard output.

HINT: In order to print your output as an integer, without any decimal places, you may make use of the Java method println. Heres an example of how you would correctly use this method in your program: System.out.println((int) output);

If you wish, you may also use the methods Math.abs() and Math.floor()

You may NOT, however use the method Math.sqrt(). Doing so will immediately give you a zero for this assignment. You are meant to implement the Babylonian algorithm seen in the class.

Here is Babylonian algorithm pseudocode

image text in transcribed

INPUT: IntegerN OUTPUT: Float r such that|r VN 1 (a + N/a) 3. 2 at 4. return a

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

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions

Question

Be able to differentiate between arbitration and mediation

Answered: 1 week ago