Given the integer array dailyPrices with the size of NUM_ELEMENTS, assign numMatches with the number of integers in userValues that are equal to 9.
Ex: If the input is 109 9 38 51 9 9 104 9, then the output is:
Number of 9s in array: 4
import java.util.Scanner;
public class ValueMatcher {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
final int NUM_ELEMENTS = 8;
int[] dailyPrices = new int[NUM_ELEMENTS];
int i;
int numMatches;
for (i = 0; i < dailyPrices.length; ++i) {
dailyPrices[i] = scnr.nextInt();
}
/* Your code goes here */
System.out.println("Number of 9s in array: " + numMatches);
}
}
i cant solve this question without changing the given loop, but my code can only go in the comment. Please help