Question: 2) Create a program that will generate an array of random values, and then count the instances of one randomly chosen value. (10 pts) )

 2) Create a program that will generate an array of random

2) Create a program that will generate an array of random values, and then count the instances of one randomly chosen value. (10 pts) ) Create a new package "task2" and a new class in that package "ArrayCounter". Add the empty "main" method in your class. d) Problem o main: (no methods besides main are needed for this problem) Generate a random integer value called "size" between 1 and 1001 Example: 1(int) (Math.random() 1000); Create an int array called "values" using that "size" value. - Set each array element to a random int value between 0 and 100. Example: (int) (Math.random() *100) -Generate a random integer value called "toFind" between 0 and 100. Create an integer counter variable, and set it to zero. Check each element of the int array "values" to see if it equals the "toFind" value. If it does, increment the counter variable. Finally, after checking all the values in the array, print the number of times you found the "toFind" value Example: The value 35 appears 9 times

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!