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

C Programming Language Goals • Practice with creating and using arrays • Practic

ID: 3697026 • Letter: C

Question

C Programming Language

Goals

• Practice with creating and using arrays

• Practice with generating random numbers

• Use an array to tally data

Tasks

1. Write a program to tally how many times a random dice roll falls on each of the 6 numbers:

a. Ask the user to enter how many times the dice will get rolled

b. Simulate each dice roll by generating a random number between 1 and 6

c. Use an array to tally how many times each of the 6 numbers was rolled

d. Print a count for the user showing how many times each number was rolled

2. The output should look similar to the example below:

How many times would you like to roll? 10000

Here's what you rolled:

1 = 1652

2 = 1703

3 = 1680

4 = 1655

5 = 1653

6 = 1657

Thanks for playing!

Explanation / Answer

public class diceGame { public static void main(String[] args) { int dice1; int dice2; int count = 0; int theSum = 0; int lowest = Integer.MAX_VALUE; int finalSum = 0; int diceSum; int totalSum=0; while (count finalSum) { finalSum = theSum; } if (theSum