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

public class BingoMac { public static int drawNum(){ Random rand = new Random();

ID: 3540899 • Letter: P

Question

public class BingoMac {
    
    public static int drawNum(){
        Random rand = new Random();
        int num = rand.nextInt(75-1+1)+1;
        return num;
    }
    
    public static void bingoCard(){
        
        int [][]card=new int [5][5];
        ArrayList<Integer> alreadyUsed = new ArrayList<Integer>();
        boolean valid = false;
        int tmp = 0;

        for(int row=0; row < card.length; row++){
            while(!valid){
                tmp = (int)(Math.random()*15)+1;
                if(!alreadyUsed.contains(tmp)){
                    valid = true;
                    alreadyUsed.add(tmp);
                }
            }
            card[row][0]= tmp;
            valid = false;
        }

        for(int row=0;row<card.length;row++){
            while(!valid){
                tmp = (int)(Math.random()*15)+16;
                if(!alreadyUsed.contains(tmp)){
                    valid = true;
                    alreadyUsed.add(tmp);
                }
            }
            card[row][1]= tmp;
            valid = false;
        }

        for(int row=0;row<card.length;row++){
            while(!valid){
                tmp = (int)(Math.random()*15)+31;
                if(!alreadyUsed.contains(tmp)){
                    valid = true;
                    alreadyUsed.add(tmp);
                }
            }
            card[row][2]= tmp;
            valid = false;
        }

        card[2][2]=0;

        for(int row=0;row<card.length;row++){
            while(!valid){
                tmp = (int)(Math.random()*15)+46;
                if(!alreadyUsed.contains(tmp)){
                    valid = true;
                    alreadyUsed.add(tmp);
                }
            }
            card[row][3]= tmp;
            valid = false;
        }

        for(int row=0;row<card.length;row++){
            while(!valid){
                tmp = (int)(Math.random()*15)+61;
                if(!alreadyUsed.contains(tmp)){
                    valid = true;
                    alreadyUsed.add(tmp);
                }
            }
            card[row][4]= tmp;
            valid = false;
        }

        //create array to make title.  
        String title []={"B","I","N","G","O"};

        for(int i=0;i<title.length;i++){
            System.out.print(title[i]+ " ");
        }

        System.out.println();
        
        for(int row=0;row<card.length;row++){
            for(int col=0;col<card[row].length;col++){
                System.out.print(card[row][col]+ " ");
            }

            System.out.println();
        }
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        bingoCard();
    }
}


I have this piece of code so far, which as of now, prints out a Bingo Card game. I also created a method that pulls out random integers from 1 - 75. My next part is to make the game play itself, and that is the area I am quite confused with. Once the game reaches a winning condition (there is a total of 12 winning conditions to this Bingo Game - vertical, diagonal, and horizontal), then it stops playing.

Explanation / Answer

....