Math.floor can be used to round values to the nearest integere.g., double y = Math.floor(x + 0.5);

Question:

Math.floor can be used to round values to the nearest integer—e.g.,

double y = Math.floor(x + 0.5);

will round the number x to the nearest integer and assign the result to y. Write an application that reads double values and uses the preceding statement to round each of the numbers to the nearest integer. For each number processed, display both the original number and the rounded number.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java How To Program Late Objects Version

ISBN: 9780136123712

8th Edition

Authors: Paul Deitel, Deitel & Associates

Question Posted: