2. Write a java method that rounds a double number as shown below, without using String, Math or printf(). (5 marks) // ???? ??????? ??????? ??????? ???? ????? ? 4 ????? ????? a. Input: 123.1478131 input: 123.5743689 b. Output: 123.1478 output: 123.5744
Added by Jason T.
Close
Step 1
First, we need to determine the number of decimal places to round to. In the given examples, it is 4 decimal places. Show more…
Show all steps
Your feedback will help us improve your experience
Maryam Riaz and 78 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a java program by taking two variables num1 and num2 with values of your own and perform the following operations, Addition between two numbers and display answer, Multiplication between two numbers and display answer, division between two numbers and display answer.
Shelayah R.
Supreeta N.
Write a program to input a number and print the sum of its even digits and odd digits separately. (In BlueJ)
Sarvesh S.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD