Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions