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

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.

Step by Step Solution

3.28 Rating (163 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The task you have requested is a Java application that reads in double values rounds them to the nea... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java How To Program Late Objects Questions!