Implement Bingo Game

[ad_1]
I. Implement Bingo GameProblem DescriptionIn the game of Bingo, numbers are chosen at random from a set between 1 and 75 inclusive. The numbers in the range:· 1 to 15 are associated with the letter B· 16 to 30 are associated with the letter I· 31 to 45 are associated with the letter N· 46 to 60 are associated with the letter G· 61 to 75 are associated with the letter OThe person managing the game (“the caller”) selects a number from the Bingo drum randomly, and then announces the letter and the number. The caller then sets aside that number so that it cannot be used again in that game. All the players then mark any squares on their card that match the letter and the number called. Once any player has five squares in a row, they announce “BINGO!” and claim their prize.For this program however, please note that:1. The player can announce “BINGO” as soon as (s)he gets one number for each letter, not necessarily in a row. For example, 2 25 31 58 70 would be a winning combination.2. Multiple winners are possible.The following picture shows a sample bingo card:public class BingoChip
{
private char letter;
private int number;
public BingoChip(int number)
{
setNumber(number);
setLetter();
}
private void setNumber(int number)
{
// TODO Project 2.1 }
private void setLetter()
{
// TODO Project 2.1 }
public int getNumber()
{
// TODO Project 2.1 return 0;
}
public char getLetter()
{
// TODO Project 2.1 return ‘?’;
}
public String toString()
{
// TODO Project 2.1 return “???”;
}
}import java.util.*;
public class BingoCard
{
private HashMap<Character, TreeSet> card;
public final static String BINGO_KEYS = “BINGO”;
public final static int MAX_VALUES_PER_LETTER = 15;
public final static int NUMBERS_PER_LETTER = 5;
public BingoCard()
{
// TODO Project 2.2 }
public boolean hasNumber(BingoChip chip)
{
// TODO Project 2.2 return false;
}
public String toString()
{
// TODO Project 2.2 // utilize StringBuffer and String.format
// utilize forEach lambda construct to process a row
return “???”;
}
public boolean equals(Object o)
{
// TODO Project 2.2 return false;
}
}import java.util.TreeSet;
public class Player
{
private TreeSet bingoChars;
private BingoCard bingoCard;
public Player()
{
// TODO 2.3 }
public boolean isWinner()
{
// TODO 2.3 return false;
}
public void checkCard(BingoChip chip)
{
// TODO 2.3 }
public void printCard()
{
// TODO 2.3 }
}import java.util.*;
public class BingoGame
{
public final static int NUMBER_OF_CHIPS = 75;
private int numberOfPlayers;
private ArrayList bingoDrum;
private Player[] players;
public BingoGame(int numOfPlayers)
{
// TODO Project 2.4 }
private void createBingoDrum()
{
// TODO Project 2.4 }
private void createPlayers()
{
// TODO Project 2.4 }
private void setNumOfPlayers(int numOfPlayers)
{
// TODO Project 2.4 }
public int getNumberOfPulledChips()
{
// TODO Project 2.4 return 0; // This is a stub
}
public BingoChip pullChip()
{
// TODO Project 2.4 return null; // This is a stub
}
public void play()
{
// TODO Project 2.4 }
}import java.util.*;
public class PlayBingo
{
public static void main(String[] args)
{
System.out.println(“—> Setting up bingo game.”);
Scanner scan = new Scanner(System.in);
int numOfPlayers;
do
{
System.out.println(“Enter number of players.”);
numOfPlayers = scan.nextInt();
} while (numOfPlayers < 1);
BingoGame game = new BingoGame(numOfPlayers);
System.out.println(“—> Starting the game with ” + numOfPlayers + ” players:”);
System.out.println(” *********************************n”);
game.play();
}
}Sample run of the program:—> Setting up bingo game.Enter number of players.4—> Creating bingo card for Player 1B 1 4 5 10 14I 17 20 25 26 27N 32 35 39 43 45G 46 48 51 55 56O 63 66 68 69 71—> Creating bingo card for Player 2B 5 6 9 10 15I 17 20 25 29 30N 31 32 38 39 43G 46 47 49 50 57O 63 70 71 72 74—> Creating bingo card for Player 3B 4 6 10 11 15I 18 19 21 23 29N 35 36 40 41 42G 48 50 55 56 57O 63 67 69 73 74—> Creating bingo card for Player 4B 6 11 12 13 15I 24 25 26 27 28N 32 33 42 43 45G 47 52 53 56 59O 61 62 67 70 74—> Starting the game with 4 players: *********************************—> Calling: O 63Player’s 1 card:B 1 4 5 10 14I 17 20 25 26 27N 32 35 39 43 45G 46 48 51 55 56O 0 63 66 68 69 71Player’s 2 card:B 5 6 9 10 15I 17 20 25 29 30N 31 32 38 39 43G 46 47 49 50 57O 0 63 70 71 72 74Player’s 3 card:B 4 6 10 11 15I 18 19 21 23 29N 35 36 40 41 42G 48 50 55 56 57O 0 63 67 69 73 74Player’s 4 card:B 6 11 12 13 15I 24 25 26 27 28N 32 33 42 43 45G 47 52 53 56 59O 61 62 67 70 74….
[ad_2]Source link
 
“Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!”

What Students Are Saying About Us

.......... Customer ID: 12*** | Rating: ⭐⭐⭐⭐⭐
"Honestly, I was afraid to send my paper to you, but splendidwritings.com proved they are a trustworthy service. My essay was done in less than a day, and I received a brilliant piece. I didn’t even believe it was my essay at first 🙂 Great job, thank you!"

.......... Customer ID: 14***| Rating: ⭐⭐⭐⭐⭐
"The company has some nice prices and good content. I ordered a term paper here and got a very good one. I'll keep ordering from this website."

"Order a Custom Paper on Similar Assignment! No Plagiarism! Enjoy 20% Discount"