Okay so the program I was asked to design requires the simulation of rolling three dice and printing out the outcome of each turnout while adding to a counter until all three dice are different numbers. So a sample output would be:
5 6 2
count: 1
or
3 4 3
5 2 2
4 6 4
1 3 2
count: 4
So far I have the following code:
import java.util.Random;
import apcslib.*;
public class Rolling
{
public static void main(String[] args)
{
private Random myDie;
double seed = Math.random() * 10;
int seedInt = (int)seed;
myDie = new Random (seedInt);
int counter = 0;
do
{
int dieRollOne = die.nextInt(6) + 1;
int dieRollTwo = die.nextInt(6) + 1;
int dieRollThree = die.nextInt(6) + 1;
counter += 1;
System.out.println(dieRollOne + " " + dieRollTwo + " " + dieRollThree);
}
while ((dieRollOne == dieRollTwo) || (dieRollOne == dieRollThree)
|| (dieRollTwo == dieRollThree));
if(!(dieRollOne == dieRollTwo) && !(dieRollOne == dieRollThree)
&& !(dieRollTwo == dieRollThree));
{
System.out.println("Count = " + counter);
}
}
}
I've received an illegal start of expression for:
private Random myDie;
and for the initialization of do on:
do
{
. . .
If anyone can give any assistance I would be greatly appreciative.