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

Using java, What is the ElevensBoard class missing (states and behaviors) that m

ID: 3682334 • Letter: U

Question

Using java, What is the ElevensBoard class missing (states and behaviors) that makes it impossible to play the game? Explain.

public class ElevensBoard {
private static final int BOARD_SIZE = 9;
private static final String[] RANKS = {"ace", "2", ..."9", "10", "jack", "queen", "king"}; private static final String[] SUITS = {"spades", "hearts", "diamonds", "clubs"}; private static final int[] POINT_VALUES = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0};

private Card[] cards;
private Deck deck;
private static final boolean I_AM_DEBUGGING = false;

public ElevensBoard() {
cards = new Card[BOARD_SIZE];

deck = new Deck(RANKS, SUITS, POINT_VALUES); dealMyCards();

}

public void newGame() { deck.shuffle();

dealMyCards(); public boolean isEmpty() {

Returns true if the board is empty; false otherwise

}
public void deal(int k) {

// cards currently displayed // flag for debugging

}

Takes a card from the deck and places it at index k (which should be 0 to BOARD_SIZE-1)

}
public Card cardAt(int k) {

Returns the card at index k (which should be 0 to BOARD_SIZE-1)

}
public void replaceSelectedCards(List<Integer> selectedCards) {

Replace the cards on the board at the selected indices with cards from the deck

}
public List<Integer> cardIndexes() {

Returns list of indices of places on the board that contain Cards (i.e. are not null)

}
public String toString(){

Returns string representation of the cards on the board

}

public boolean gameIsWon(){

}

returns true if the game is won; otherwise returns true

public boolean isLegal(List<Integer> selectedCards) {

The list contains of indices of cards on the board that the user selected to remove. This method returns true if it is a pair of non-face cards that add up to 11 or it is the indices of a king, queen, and jack in any order. Otherwise the method returns false.

}
public boolean anotherPlayIsPossible() {

Returns true if there are still any legal plays left; otherwise false.

}
private void dealMyCards() {

Deal cards from the deck and fill the board.

}

private boolean containsPairSum11(List<Integer> selectedCards) {

Returns true if the list contains at least two indices where the cards at those indices add up to 11;otherwise it returns false.

}

private boolean containsJQK(List<Integer> selectedCards) {

Returns true if the list contains at least three indices where the cards at those indices are a king, queen, and jack (in any order); otherwise it returns false.

}

}

Explanation / Answer

package com.raj.dreampack;

public class ElevensBoard {
private static final int BOARD_SIZE = 9;
private static final String[] RANKS = {"ace", "2","9", "10", "jack", "queen", "king"};
private static final String[] SUITS = {"spades", "hearts", "diamonds", "clubs"};
private static final int[] POINT_VALUES = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0};
private Card[] cards;
private Deck deck;
private static final boolean I_AM_DEBUGGING = false;
public ElevensBoard() {
cards = new Card[BOARD_SIZE];
deck = new Deck(RANKS, SUITS, POINT_VALUES);
dealMyCards();
}
public void newGame() {
deck.shuffle();
dealMyCards();
public boolean isEmpty() {
//Returns true if the board is empty; false otherwise
}
public void deal(int k) {
// cards currently displayed // flag for debugging
}
//Takes a card from the deck and places it at index k (which should be 0 to BOARD_SIZE-1)
}
public Card cardAt(int k) {
//Returns the card at index k (which should be 0 to BOARD_SIZE-1)
}
public void replaceSelectedCards(List<Integer> selectedCards) {
//Replace the cards on the board at the selected indices with cards from the deck
}
public List<Integer> cardIndexes() {
//Returns list of indices of places on the board that contain Cards (i.e. are not null)
}
public String toString(){
//Returns string representation of the cards on the board
}
public boolean gameIsWon(){
//returns true if the game is won; otherwise returns true
}

public boolean isLegal(List<Integer> selectedCards) {
//The list contains of indices of cards on the board that the user selected to remove. This method returns true if it is a pair of non-face cards that add up to 11 or it is the indices of a king, queen, and jack in any order. Otherwise the method returns false.
}
public boolean anotherPlayIsPossible() {
//Returns true if there are still any legal plays left; otherwise false.
}
private void dealMyCards() {
//Deal cards from the deck and fill the board.
}
private boolean containsPairSum11(List<Integer> selectedCards) {
//Returns true if the list contains at least two indices where the cards at those indices add up to 11;otherwise it returns false.
}
private boolean containsJQK(List<Integer> selectedCards) {
//Returns true if the list contains at least three indices where the cards at those indices are a king, queen, and jack (in any order); otherwise it returns false.
}
}

The Above programm is missing the declarations of Two classes viz: Card and Deck respectively. And also the the metho definations, Commentes are not properly given which will leads to syntax error.

Finally,

We are calling deck.shuffle();
dealMyCards();

But we need to assciate them with classes and define them.

Please implemet the classes for card and deck. And the define the operations of each methods in then.

And main important , Defain main class where it contains main method which will drive these classes and methods.

Thanks.

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