QA questions
a. Select minimum number of test cases to achieve 100% statement coverage in ReturnAverage()
b. Select minimum number of paths to achieve 100% branch coverage in ReturnAverage()
/* Function: ReturnAverage computes the average of all those numbers in the input array in the positive range [MIN, MAX]. The maximum size of the array is AS. But, the array size could be smaller than AS in which case the end of input is represented by -999. */
public static double ReturnAverage(int value[], int AS, int MIN, int MAX){
int i, ti, tv, sum;
double av;
i = 0; ti = 0; tv = 0; sum = 0;
while (ti < AS && value[i] != -999) {
ti++;
if (value[i] >= MIN && value[i] <= MAX) {
tv++;
sum = sum + value[i];
}
i++;
}
if (tv > 0)
av = (double)sum/tv;
else
av = (double) -999;
return (av);
}