ICS 111 Homework Assignment H03: Simulate a pair of six sided dice

1) How many times do you have to roll a pair of six sided dice before they come up seven? You could do the experiment by rolling the dice by hand. Write a computer program that simulates the experiment. The program should report the number of rolls that it makes before the dice come up seven.

The text’s Exercise 2.2 explained how to simulate rolling a pair of dice.

2) Modify the program to ask the user for a number between 2 and 12, then run the simulation counting the rolls before the dice come up with the user’s choice.

Turning in the Assignment

The assignment is due on Friday at 11:55pm. You may turn it in early.

  1. Conduct a personal review of your code before turning it in. Does your code follow the Java Coding Standard?

    Is it clear and well commented?

  2. Test your code.

    • Does it produce the correct output? How do you know?
  3. Sign into Laulima, then navigate to the ICS111 site. In the left hand side of the site, there is an Assignments tab/link. Click on it and view all of the posted assignments. Select the assignment that you want to turn in and attach your files and accept the honor pledge to submit the assignment.