Question: Write a method that accepts an array of ints that has been filled with a random number between 1-10 at each index. Your method should

Write a method that accepts an array of ints that has been filled with a random number between 1-10 at each index. Your method should count the number of times that the number 7 appears in the array. In eclipse for java.

public class Problem05 {

public static void main(String[] args) {

int myArray[] = {1,2,3,4,5,6,7,8,9,10,7,7,7};

System.out.println(countSevens(myArray));

}

public static int countSevens(int[] myArray) {

// Your code here

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!