Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

---------- BingoChip.java /** * @author YOUR NAME * @version 4/10/2018 */ public class BingoChip { private char letter; private int number; public BingoChip(int number) {

image text in transcribedimage text in transcribedimage text in transcribed

----------

BingoChip.java

/**  * @author YOUR NAME  * @version 4/10/2018  */  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 "???"; } }

---------------------------

BingoCard.java

import java.util.*;

public class BingoCard { private HashMap> 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; } }

------------------------

Player.java

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  } } 

-----------------------------

BingoGame.java

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  } }

------------------------

PlayBingo.java

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 out.println("---> Starting the game with " + numOfPlayers + " players:"); System.out.println(" ********************************* "); game.play(); } }

II Implement Bingo Game Problem Description In 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 l 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 Q The 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. Multiple winners are possible. 2. The following picture shows a sample bingo card: N G O 9 (2534 48 69 15 19 3159 74 228 33 52 62 7 16 41 5 70 4 20 38 47 64 II Implement Bingo Game Problem Description In 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 l 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 Q The 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. Multiple winners are possible. 2. The following picture shows a sample bingo card: N G O 9 (2534 48 69 15 19 3159 74 228 33 52 62 7 16 41 5 70 4 20 38 47 64

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions