Question: Write a method that takes an array of type int and returns a double value. The method returns the average value of the positive
Write a method that takes an array of type int and returns a double value. The method returns the average value of the positive elements of the taken array. Output Sample run int[] in = {1, 5, 7, -1, 0, 3, -15); double out = avgPositive(in); System.out.println("Result: " + out); int[] in = {1, 3, 3, 5, 15); double out = avgPositive(in); System.out.println("Result: " + out); Result: 4.0 Result: 5.4
Step by Step Solution
There are 3 Steps involved in it
Sure Heres a method that takes an array of type int and returns the average value of the posi... View full answer
Get step-by-step solutions from verified subject matter experts
