Menu

[Solved]Java Part 1 Write Java Program Generate 200 Random Integers Range 0 999 Inclusive Find Ap Q37085672

JAVA.

Part 1.

Write a Java program to generate 200 random integers in therange of 0 and 999 (both inclusive). Then find the appearancefrequency of each digit (0-9) in these numbers, and print afrequency histogram.

Detailed Instructions

  1. Write this program using an array

  2. Use switch statements for digit frequency counting.

  3. When you split an integer, make sure you get all 3 digits. Forexample:

    number digit1 digit2 digit3 402 4 0 2 75 0 7 5 6006 900 9 00

    Hint: use integer division and modulus operations.

  4. For each digit from 0 to 9:

    • Display the digit and the frequency count.
    • Display the horizontal frequency bar of asterisks using a forloop.

    For example, digit 5 with a frequency count 28 will display abar like this:

    5 (28): ****************************

  5. Every time your program runs, it should generate differentrandom numbers and different results.

Expected Frequency Analysis

Perform a formal mathematical analysis on the expected digitfrequencies. What is the expected frequency of each digit (0-9) ifwe generate 200 random integers between 0 and 999?

Expert Answer


Answer to JAVA. Part 1. Write a Java program to generate 200 random integers in the range of 0 and 999 (both inclusive). Then find… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *