JAVA ARRAYS

Anonymous
timer Asked: Nov 25th, 2013

Question description


Find out how often the numbers from 1 to 10 are generated randomly. Declare an array to hold 10 integer elements. Generate 100 random numbers from 1 to 10 inclusive, and use the array to keep track of how many times each number occurs. For example, if the first number generated is 9, add 1 to the 9th element of the array. If the second number generated is 3, add 1 to the 3rd element of the array. If the third number generated is 9, add another 1 to the 9th element of the array. After 100 numbers have been generated, each element of the array will hold the number of times that value was generated. Display the array.

In this example, we're using the array as a frequency table to keep track of the frequency of each of the 10 numbers.

Tutor Answer

(Top Tutor) Studypool Tutor
School: University of Virginia
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors