Skip to content

Latest commit

 

History

History
113 lines (59 loc) · 1.63 KB

README-IntegerArrayUtils.md

File metadata and controls

113 lines (59 loc) · 1.63 KB

IntegerArrayUtils

  • Ensure each of the test cases in the class IntegerArrayUtilsTest successfully passes upon completion of each of the method stubs in the class IntegerArrayUtils.
    • Integer getSum(Integer[] intArray)
    • Integer getProduct(Integer[] intArray)
    • Double getAverage(Integer[] intArray)





Integer getSum(Integer[] intArray)

  • Description
    • Given an Integer array, intArray, return the sum of all values in the array.

Example

  • Sample Script

    // : Given
    Integer[] input = { 1, 2, 3, 4, 5};
    
    // : When
    Integer outcome = IntegerArrayUtils.getSum(input);
    
    // : Then
    System.out.println(outcome);
    
  • Sample Output

    15
    





Integer getProduct(Integer[] intArray)

  • Description
    • Given an Integer array, intArray, return the product of all values in the array.

Example

  • Sample Script

    // : Given
    Integer[] input = { 1, 2, 3, 4, 5};
    
    // : When
    Integer outcome = IntegerArrayUtils.getProduct(input);
    
    // : Then
    System.out.println(outcome);
    
  • Sample Output

    120
    





Integer getAverage(Integer[] intArray)

  • Description
    • Given an Integer array, intArray, return the sum of all values in the array.

Example

  • Sample Script

    // : Given
    Integer[] input = { 1, 2, 3, 4, 5};
    
    // : When
    Integer outcome = IntegerArrayUtils.getAverage(input);
    
    // : Then
    System.out.println(outcome);
    
  • Sample Output

    3.0