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

I have no idea of this program and i need some help. Please!!! Start writing the

ID: 3541611 • Letter: I

Question

I have no idea of this program and i need some help. Please!!!

Start writing the code for the BingoCard class:

Using the menu File->New, create a new file and save it as BingoCard.java.

Declare a private attribute of a 5 x 5 array of BingoSquare objects to represent the card.  Modify your UML diagram accordingly.

Look at the code in the BingoGame class to see what methods you need to implement and modify your UML diagram accordingly.

Write the default constructor.  You should instantiate a 5 x 5 array of BingoSquare objects with a unique number between 1 and 15 for each square in column 0, a unique number between 16 and 30 for each square in column 1, etc.  Use a null reference value in the center square to represent the free square.  You can choose the specific values that the default constructor puts into the 5 x 5 array.  You might want to use the values shown below.

Write the toString method.  It should return a String with each of the 5 rows of numbers separated by end of line characters.  For each square that is not null, use theBingoSquare toString method.  If the object reference for any square is a null value, it should return

Explanation / Answer

public class BingoSquare

{

private char letter;

private int number;

/******************************************************************

Sets up this Bingo square with the specified number and the

appropriate letter.

******************************************************************/

public BingoSquare (int num)

{

number = num;

if (num <= 15)

letter = 'B';

else

if (num <= 30)

letter = 'I';

else

if (num <= 45)

letter = 'N';

else

if (num <= 60)

letter = 'G';

else

letter = 'O';

}

/******************************************************************

Returns a string representation of this Bingo square.

******************************************************************/

public String toString ()

{

return (letter + " " + ((number > 9) ? number : "0" + number));

}

}

import java.util.*;

public class BingoCard {

private BingoSquare Array1[][] = new BingoSquare[5][5];

public static void main(String[] args) {

}

public BingoCard()

{

Random r = new Random();

int num = r.nextInt(75);

if (num <= 15)

for(int i = 0; i <= 5; i++){

Array1 [i][0] = new BingoSquare (num);

}

else if(15 < num && num <= 30)

Array1 [1][1] = new BingoSquare (num);

else if (30 < num && num <= 45)

Array1 [2][2] = new BingoSquare (num);

else if (45 < num && num <= 60)

Array1 [3][3] = new BingoSquare (num);

else if (60< num && num <= 75)

Array1 [4][4] = new BingoSquare (num);

}

public String Stostring()

{

086

return Array1[0][0].toString() + " " + Array1[0][1].toString() + " ";

}

}

public class BingoGame

{

/******************************************************************

Creates myBingoCard (a 5 x 5 array of BingoSquares)

Prints the contents of myBingocard

*******************************************************************/

public static void main (String[] args)

{

// create a bingo card

BingoCard myBingoCard = new BingoCard();

// display the contents of myBingoCard

System.out.println(myBingoCard);

}