Write a program that generates n random integers between 0 and 9 and

 

Write a program that generates n random  integers between 0 and 9 and displays the count for each number. (Hint:  Use an array of ten integers, say count, to store the counts for the  number of 0s, 1s, . . . , 9s.)

A modular program is expected – use Methods. The program specifications are as below. 

  1. In the main() method, declare an int array of size 10, named count.
  2. Implement a method populateCount(int[] cnt) that initializes the array to zero.
  3.  Implement a method countNums(int[] cnt, int n) that accepts  the count array and an integer n. The method should generate n random  numbers in the range of 0 to 9. It should keep a count of how many times  each number, 0 to 9; is generated in the array count. 
  4. Implement a method printNums(int[] cnt) to print the count  array.  Note, print “time” or “times” – which ever is appropriate. 
  5. Use basic structured programming and procedural programming.
  6.  Write a main() method that declares the count array. Invokes  the countNums() method with n = 10 followed by invoking the printNums().  Then invokes the countNums() method with n = 100 followed  by printNums(). And again, invokes the countNums() method with n =  1000 followed by printNums(). 
  7. Make sure you invoke  the populateCount(int[] cnt) method at appropriate times. And write out  the heading for each set, n = 10, 100, and 1000.
  8. Documentation. Includes your name, create date and purpose of lab.
Calculate your order
Pages (275 words)
Standard price: $0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back
If you're confident that a writer didn't follow your order details, ask for a refund.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Power up Your Academic Success with the
Team of Professionals. We’ve Got Your Back.
Power up Your Study Success with Experts We’ve Got Your Back.