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

A Bingo card consists of 5 columns and 5 rows. Each column has a range of number

ID: 3677956 • Letter: A

Question

A Bingo card consists of 5 columns and 5 rows. Each column has a range of numbers from which the spaces in that column can be populated:

Column 0 (the ‘B’ column): 1-15

Column 1 (the ‘I’ column): 16-30

Column 2 (the ‘N’ column): 31-45

Column 3 (the ‘G’ column): 46-60

Column 4 (the ‘O’ column): 61-75

No number is repeated in any column. The center space is considered a free space and has no number (it is considered
automatically marked).

In a game of Bingo, numbers are called randomly, and those numbers apply to all cards in play. Any cards in play may
mark any number that is called if it appears on that card. It is common to call bingo numbers with the letter of their
column, such as B-12, but this is not necessary, since a 12 can only be in the B column.

The first card that marks a complete line of spaces either horizontally, vertically, or diagonally wins immediately.

Implement the following class for a bingo card. The methods shown are a minimum requirement. You may add
additional methods if you wish.

cardNumbers: int []

-cardMarks: boolean [][]

-calls: int []
-callsMade: int
+BingoCard()
+BingoCard(numbers: int [][])
-setNumber(number: int,
row: int, col:int): void
+getCardNumbers(): int [][]
+getCardmarks(): boolean [][]
+markCard(): void
+isBingo(): Boolean
+setCalls(int []): void
+getCalls(): int []
+addCall(int callNumber): void

There may not be more than two statements using array indices which do not change.

Explanation / Answer

import java.util.Random;

public class Bingo
{
    Random randNum = new Random();
    int[][] card_num = new int[5][5];
    boolean[][] shadow = new boolean[5][5];

    public Bingo()
    {
    for(int i = 0; i < card_num.length; i++)
    {
        this.card_num[i][0] = randInt(1, 15);
        while(this.card_num[i][0] != card_num[i][0])
        {
            i++;
        }
        if(this.card_num[i][0] == card_num[i][0])
        {
            card_num[i][0] = randInt(1, 15);
        }
    }

    for(int j = 0; j < card_num.length; j++)
    {
        card_num[j][1] = randInt(16, 30);
    }
  
    for(int k = 0; k < card_num.length; k++)
    {
        card_num[k][2] = randInt(31, 45);
        card_num[2][2] = 0;
     
    }
    
    for(int m = 0; m < card_num.length; m++)
    {
        card_num[m][3] = randInt(46, 60);
     
    }
  
    for(int n = 0; n < card_num.length; n++)
    {
        card_num[n][4] = randInt(61, 75);
     

    }


    for(int i = 0; i < shadow.length; i++)
    {
        for(int j = 0; j < 5; j++)
        {
            shadow[i][j] = false;
            shadow[2][2] = true;
        }
    }

    }

private int randInt(int min, int max)
{
    int random;
    random = randNum.nextInt(max - min) + min;
    return random;
}

public String Print_Card()
{
    String string = "";
    for(int row = 0; row < card_num.length; row++)
    {
        for(int col = 0; col < card_num[row].length; col++)
        {
            System.out.print(card_num[row][col] + " ");
        }
        System.out.println();
    }
    return string;
}


    public static void main(String[] args)
    {
        Bingo bc = new Bingo();
        bc.Print_Card();

    }


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote