Question: We want a program that generates a simple histogram based on the roll of a single die. Write an error-free Java program to do the
We want a program that generates a simple histogram based on the roll of a single die. Write an error-free Java program to do the following things. Generate 50 random numbers that are integers from 1 to 6. (It is best to use a loop to generate the numbers.) The program only needs to generate one random number at a time. The number represents a simulated die roll. Use an array to count how many times each die roll occurs. Display how many times each die roll occurred. That is, display how many times a 1 happened, a 2 happened, etc . Determine which die roll occurred most often. One can ignore ties; that is, if two or more numbers occur the same amount, just specify one of the numbers . Determine which die roll occurred most often. One can ignore ties; that is, if two or more numbers occur the same amount, just specify one of the numbers Sample output: Number of 1 die rolls-6 2 2 Number of 2 die rolls 15 Number of 3 die rolls = 5 Number of 4 die rolls-6 Number of 5 die rolls-10 2 Number of 6 die rolls 8 PIF . 2 had the most simulated tosses
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
