Question: Write a method that will take in a double value and round it down to the nearest whole number and return it as an integer.
Write a method that will take in a double value and round it down to the nearest whole number and return it as an integer. Here is a stub to get you started:
public class Problem24 { public static void main(String[] args) { System.out.println(roundDown(1.9)); // 1 System.out.println(roundDown(3.2)); // 3 System.out.println(roundDown(3.0)); // 3 System.out.println(roundDown(17.9999)); // 17 } public static int roundDown(double number) { // Your code here } } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
