Hi there, I'm a newbie in Java and I'm having problems when I try to compile this program. I don't now What I'm doind wrong here. Is saying that there is a error on line 39.
import java.util.*;
import java.util.ArrayList;
public class Player {
public Player (){
Die dice; // A variable that will refer to the dice.
int rollCount = 0; // Number of times the dice have been rolled.
dice = new Die(); // Create the dice object.
ArrayList<Integer> list = new ArrayList<Integer>();
int i=0;
do {
dice.roll();
i = dice.getDie();
System.out.println("Number Rolled " +i);
rollCount++;
if (!list.contains(i)) /*list numbers given by Die*/
list.add(i);
System.out.println("So far, you have" + list);/*Shows on the screen the result*/
}
while (list.size() < 6);
}
public int getrollCount(){
return rollCount;
}
} // end class
Anyone can give a hand here to fix this error.
Thank you in advance.
Bookmarks