Question: Create a Java static method named a verageOfEven that takes an array of integers as a parameter and returns a double value representing the average

Create a Java static method named averageOfEven that takes an array of integers as a parameter and returns a double value representing the average of the values in the array that are even numbers. Your method must work for an int array of any size. Example: If the array contains [13, 48, 16, 99], the method would return (48 + 16) / 2 = 32 as double value.

Hint: the amount of even numbers need to be counted. Example values should not appear in your code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!