
Concept explainers
To round numbers to specific decimal places, use a statement 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:
- 1. roundTolnteger(number)
- 2. roundToTenths(number)
- 3. roundToHundredths(number)
- 4. roundToThousandths(number)
For each value read, your

Want to see the full answer?
Check out a sample textbook solution
Chapter 6 Solutions
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Additional Engineering Textbook Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Concepts Of Programming Languages
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Mechanics of Materials (10th Edition)
Management Information Systems: Managing The Digital Firm (16th Edition)
- Considering the code below and the obtained output, which function would you consideroptimizing? Explain your choice. Limit your answer to no less than 2 lines and tono more than 10 lines (soft limits).arrow_forwardI am looking for help with this general accounting question using proper accounting standards.arrow_forwardPlease explain the solution to this general accounting problem with accurate principles.arrow_forward
- Can you solve this general accounting problem using appropriate accounting principles?arrow_forwardPlease explain the solution to this general accounting problem using the correct accounting principles.arrow_forwardI am looking for the correct answer to this general accounting question with appropriate explanations.arrow_forward
- Can you help me solve this general accounting question using valid accounting techniques?arrow_forwardI need guidance with this general accounting problem using the right accounting principles.arrow_forwardI am searching for the accurate solution to this general accounting problem with the right approach.arrow_forward
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning




