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

Hello, this is for programming with the java language. (Below is my assignment p

ID: 3748263 • Letter: H

Question

Hello, this is for programming with the java language. (Below is my assignment package, please read carefully and at it also give sample output, that is our goal) I am to make a bingo card game... I have already made a method to fill up a bingo card as my assignment instructed me and i posted pictures off it at the bottom. Now all I need to do is a few things.
•1st I need to make a BitSet called bingoBalls that generates random number between 1 and 75. We are to youse BitSet because it apparently won’t generate a number that’s already been generated... at least that’s what the professor said... and I need it to print to the screen when method is called in main... •2nd I need to compare my bingoBalls to my bingo card so that when a number matches it is replaced with an X on my bingo card... I have no idea how to do that... my professor said to use StringBuffer thingy to do it... idk I posted a picture of it at the bottom along with the BitSet as well •3rd I need to checkforWin method that checks the horizontal sum, vertical sum, and diagonal sums and once one is found I need it to say “WINNER by...” and the ... is the type of win, like a vertical win. •lastly I just need to print the bingo card again but with X’s in place of the numbers that have been selected by the bingoBalls method.
Please use comments when you can.
Pleas stick to the assignment, I posted this once and it was ruined because they went crazy with it. Please just stick with my one program and just add the methods. No constructor class please, I beg of you to follow the assignment.
Thank you soooooo very much for your help, I am stressing like crazy and I couldn’t thank you enough.
Assignment package from professor I need my program to do exactly as the sample run given below... that’s the goal
BitSet example StringBuffer example
My program of just filling up a bingo card Example run Computer Science 205 Project #1 The BINGO! Game Due Date : Friday, September 21st, 11:59 PM 50 Points Objective The purpose of this assignment is to acquaint ourselves with processing multi-dimensional ar- rays. This program will utilize loops, external file i/o, random numbers, and methods with array parameters The Game of BINGO! Bingo is a popular game played on a 5 row by 5 column grid, called a card. There is one letter of the word B-I-N-G-O at the top of each column. In each space under each letter are randomly . under B, 1-15 under I, 16-30 under N, 31-45 . under G, 46-60 under O, 61-75. As numbers are selected, they are marked off the card. When a line of five squares, horizontal, vertical, or diagonal, is marked out, the card is a winner. A sample bingo card is shown below 12 28 31 49 66 3 | 26 | 45 | 53 | 75 10 17 33 59 67 7 19 42 55 74 46 If the numbers 3, 45, 53, 75, and 26 are picked at random, then there will be a horizontal bingo on the second row. Diagonal wins may be from top left corner down to bottom right corner or top right corner down to bottom left corner. No free space will be utilized.

Explanation / Answer

1) I'll start this code using java language where i will divide this into parts for each programming.
2) so, 1st point mentioned in the question is to make a BitSet called bingoballs that generates random number between 1 and 75.
So the code for it is given below:

public static final Random gen = new Random();  
public static int[] printRandomNumbers(int n, int maxRange) {  
assert n <= maxRange : "cannot get more unique numbers than the size of the range";  
  
int[] result = new int[n];  
Set<Integer> used = new HashSet<Integer>();  
  
for (int i = 0; i < n; i++) {  
  
int newRandom;  
do {  
newRandom = gen.nextInt(maxRange+1);  
} while (used.contains(newRandom));  
result[i] = newRandom;  
used.add(newRandom);  
}  
return result;  
}  
3) this code will generate the random numbers without repeatition.
4) Now, in the 2nd point its mentioned that we need to compare bingoballs to bingo card so that same numbermatches it is replaced with an X on my bingo card.

/**
02
* <p>Title: The Bingo Ball class.</p>
03
*
04
* Description: The parameterized constructor which accepts a number indicates what
05
* the Bingo Ball's properties will be based on the if statement which assigns a letter to a range
06
* of numbers.
07
* The methods getLetter and getNum return the individual values that concatenate in the
08
* toString method to define the Bingo Ball class.
09
*
10
* @author JavaJock
11
*/
12

13
public class BingoBall
14
{
15
//Instance variable
16
private char numLetter;
17
private int bingoNum;
18

19
/**
20
* Parameterized constructor
21
* Assigns the numbers a corresponding letter based on the number sent as a parameter
22
* in ranges of 15.
23
* @param randomNum
24
*/
25
public BingoBall(int randomNum)
26
{
27
bingoNum = randomNum;
28

29
if(randomNum <= 15)
30
numLetter = 'B';
31
else
32
if (randomNum <= 30)
33
numLetter = 'I';
34
else
35
if(randomNum <= 45)
36
numLetter = 'N';
37
else
38
if(randomNum <= 60)
39
numLetter = 'G';
40
else
41
numLetter = 'O';
42
}
43

44
/**
45
* getLetter method
46
* returns the variable numLetter
47
* @return the letter B, I, N, G or O.
48
*/
49
public char getLetter()
50
{
51
return numLetter;
52
}
53

54
/**
55
* getNum method
56
* returns the variable bingoNum
57
* @return a number between 1 and 75.
58
*/
59
public int getNum()
60
{
61
return bingoNum;
62
}
63

64
/**
65
* toString method
66
* concatenates and displays the numLetter and bingoNum variables
67
* @return displays the values that make up each BingoBall object
68
* separated by a space for readability.
69
*/
70
public String toString()
71
{
72
return new String(numLetter + " " + bingoNum);
73
}
74
}

5) Now fnally the last code:
package proj7;
002

003
/**
004
* <p>Title: The BingoCard class</p>
005
*
006
* <p>Description: This class will represent a bingo
007
* card. The card will have 5 columns (B, I, N, G, O)
008
* and each column will have 5 rows. Each space will
009
* have a random number appropriate for the column it
010
* is in. The user can cover up spaces on the card and
011
* check to see if he/she has bingo. </p>
012
*
013
* @author JavaJock
014
*/
015

016
public class BingoCard
017
{
018
//instance variables
019
private int[][] theCard;
020
private boolean[][] spacesCovered;
021

022
/**
023
* default constructor creates a random bingo card
024
*/
025
public BingoCard()
026
{
027
int num, rand,j;
028
boolean found;
029

030
theCard = new int[5][5];
031
spacesCovered = new boolean[5][5];
032

033
//generate random numbers for each column
034
for (int i=0; i<theCard[0].length; i++)
035
{
036
num = 0;
037
while (num < 5)
038
{
039
//generate a random number in the appropriate
040
//range based on the column currently being filled
041
rand = (int)(Math.random() * 15 + (i*15+1));
042

043
//make sure it's not already in this column
044
found = false;
045
j = 0;
046
while ((j < num) && (!found))
047
{
048
if (theCard[j][i] == rand)
049
found = true;
050
else
051
j++;
052
}
053

054
//if the number is not in the column, put it there
055
if (!found)
056
{
057
theCard[num][i] = rand;
058
spacesCovered[num][i] = false;
059
num++;
060
}
061
} //end while
062
} //end for
063
//mark the free spot as taken
064
spacesCovered[2][2] = true;
065
}
066

067
/**
068
* markLocation method
069
*
070
* @param ball
071
*/
072
public void markLocation(BingoBall ball)
073
{
074
int cardNum = ball.getNum();
075

076
for(int row = 0; row < theCard[0].length; row++ )
077
for(int col = 0; col < theCard[0].length; col++ )
078
{
079
if(theCard[row][col] == cardNum)
080
spacesCovered[row][col] = true;
081
}
082
}
083

084
//This is my problem!
085
/**
086
* bingoOrNot method
087
*
088
* @return
089
*/
090
public boolean bingoOrNot()
091
{
092
int count = 0;
093
for(int row = 0; row < theCard[0].length; row++ )
094
for(int col = 0; col < theCard[0].length; col++)
095
{
096
if(spacesCovered[row][col] == true)
097
count++;
098
}
099
if(count == 5)
100
return true;
101
else
102
return false;  
103
}
104

105
/**
106
* valueArray method
107
*
108
* @return
109
*/
110
public String valueArray()
111
{
112
String str = new String();
113

114
for(int row = 0; row < theCard[0].length; row++ ){
115
for(int col = 0; col < theCard[0].length; col++)
116
str+= spacesCovered[row][col]+" ";
117
str+= " ";
118
}
119
return str;   
120
}
121

122
/**
123
*
124
* @return
125
*/
126
public String toString()
127
{
128
String str = new String();
129

130
for(int row = 0; row < theCard[0].length; row++ ){
131
for(int col = 0; col < theCard[0].length; col++)
132
str+= theCard[row][col]+" ";
133
str+= " ";
134
}
135
return str;   
136
}
137

138

139

140

141

142

143

144

145

146

147

148
} //end BingoCard