- Ensure each of the test cases in the class IntegerUtilsTest successfully passes upon completion of each of the method stubs in the class IntegerUtils.
Integer getSumOfN(int n)
Integer getProductOfN(int n)
Integer reverseDigits(int val)
- Description
- Given an Integer,
n
, return the sum of all integers from 0 up to and includingn
- Given an Integer,
-
Sample Script
// : Given Integer input = 4; // : When Integer outcome = IntegerUtils.getSumOfN(input); // : Then System.out.println(outcome);
-
Sample Output
10
- Description
- Given an Integer ,
n
, return the product of all integers from 0 up to and includinggn
.
- Given an Integer ,
-
Sample Script
// : Given Integer input = 7; // : When Integer outcome = IntegerUtils.getProductOfN(input); // : Then System.out.println(outcome);
-
Sample Output
5040
- Description
- Given an Integer,
n
, return integer an with identical digits in the reverse order
- Given an Integer,
-
Sample Script
// : Given Integer input = 12345 // : When Integer outcome = IntegerUtils.reverseDigits(input); // : Then System.out.println(outcome);
-
Sample Output
54321