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  

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

1 Expert Approved Answer
Step: 1 Unlock

Sure Heres a method that takes an array of type int and returns the average value of the posi... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!