Answer:
Explanation:
The following function is written in Java and takes in three parameters the array, its size, and the chosenNumber that will be counted. The function then creates an instance variable called Counter and loops through the given array looking for the chosenNumber. Every time that the number is found in the array it adds 1 to the counter. Once the loop is done it returns the total value of the counter variable.
public static int counter(int[] numbers, int Size, int chosenNumber) {
int counter = 0;
for (int x = 0; x < Size; x++) {
if(numbers[x] == chosenNumber) {
counter++;
}
}
return counter;
}