You are given a series of rainfall measurements. Your task is to compute the average rainfall. Negative measurement values indicate an error. Do not include those values in the average. The series is terminated by a sentinel value of 9999. Do not include the sentinel value or any values following it. You can rely on the fact that the sentinel value is present in the array.

Complete the following file:

Rainfall.java

public class Rainfall { public static double averageRainfall(double[] rainfall) { double sum = 0; int i = 0; int count = 0;
while (. . .)
{
if (. . .)
{
. . .
} i++; }
if (. . .)
{ return 0; } else { return sum / count; } } public static void main(String[] args) { System.out.println(averageRainfall(new double[] { 1, 2, -3, -4, -5, 6, 9999 })); System.out.println(averageRainfall(new double[] { -1, -2, -3, 9999, 100 })); } }