Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA 6.10 (Rounding Numbers) To round numbers to specific decimal places, use a starement like double y = Math.floor(x * 10 + 0.5) / 10;

image text in transcribed

JAVA

6.10 (Rounding Numbers) To round numbers to specific decimal places, use a starement like double y = Math.floor(x * 10 + 0.5) / 10; which rounds x to the tenths position (i.e., the first position to the right of the decimal point), or double y = Math.Floor(x * 100 + 0.5) / 100; which rounds x to the hundredths position (i.e., the second position to the right of the decimal point). Write an application that defines four methods for rounding a number x in various ways: a) roundToInteger (number) b) roundToTenths(number) c) roundToHundredths(number) d) roundTo Thousandths(number) for cach value read, your program should display the original value, the number rounded to the carest integer, the number rounded to the nearest tenth, the number rounded to the nearest hun- dhedth and the number rounded to the nearest thousandth

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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

4. Describe the factors that influence self-disclosure

Answered: 1 week ago

Question

1. Explain key aspects of interpersonal relationships

Answered: 1 week ago