I have designed a data type called BingoCard which will create a random bingo card. I'm trying to make BingoCard into an array but I keep getting an error on this line: System.out.println(CurrentCard[i].toString());
I'm wondering if I've created the array correctly or am I doing something wrong? Thanks for any help in advance.
public class BingoGame {
private int[] counter;
private boolean done = false;
private int numOfCards;
private int fastestCard;
public BingoGame(int num){
numOfCards = num;
counter = new int[numOfCards];
}
public int play(){
for(int a=0;a<numOfCards;a++){
counter[a] = 0;
}
BingoCard[] CurrentCard = new BingoCard[numOfCards];
while(!done){
for(int i=0;i<numOfCards;i++){
System.out.println("This is the current card:");
System.out.println(CurrentCard[i].toString());
int currentNum = (int)(Math.random() * 75) + 1;
counter[i]++;
CurrentCard[i].currentNumber(currentNum);
CurrentCard[i].bingo();
if(CurrentCard[i].bingo()){
done = true;
}
fastestCard = i;
}
}
return counter[fastestCard];
}
}