Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How can I make this generate 100 random integers between 0-9and and display the

ID: 3614774 • Letter: H

Question

How can I make this generate 100 random integers between 0-9and and display the count for each? (My prof says use an array often integers, say counts, to store the counts for the number of0's, 1's ... 9's. )
public class CountNumber { public static void main(String[] args) {
// declare an integer array with 10 elements int [] myScore = new int[100]; int i; // initialize an array with random numbers for (i = 0; i < myScore.length; i++)    myScore[i] = (int)( Math.random() *10); // print an array for (i = 0; i < myScore.length; i++)    System.out.println("myScore[" + i +"]= " + myScore[i]); // count even and odd numbers using array elements asindices int count[] = {0,0}; for (i = 0; i < myScore.length; i++)    count[myScore[i]%2]++; System.out.println("The number of zeros = " count[0]"); System.out.println("The number ofDone!"); } } How can I make this generate 100 random integers between 0-9and and display the count for each? (My prof says use an array often integers, say counts, to store the counts for the number of0's, 1's ... 9's. )
public class CountNumber { public static void main(String[] args) {
// declare an integer array with 10 elements int [] myScore = new int[100]; int i; // initialize an array with random numbers for (i = 0; i < myScore.length; i++)    myScore[i] = (int)( Math.random() *10); // print an array for (i = 0; i < myScore.length; i++)    System.out.println("myScore[" + i +"]= " + myScore[i]); // count even and odd numbers using array elements asindices int count[] = {0,0}; for (i = 0; i < myScore.length; i++)    count[myScore[i]%2]++; System.out.println("The number of zeros = " count[0]"); System.out.println("The number ofDone!"); } }

Explanation / Answer

please rate - thanks public class LabArrayFive { public static void main(String[] args) { // declare an integer array with 10 elements int [] myScore = new int[10]; int i,num; // initialize an array with random numbers for (i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote