Question: 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 printf. 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 algorithm seen in class by hand.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
