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:

public class Rainfall { public static double averageRainfall(double[] rainfall) { double sum = 0; int i = 0; int count = 0;
. . .
} }