Question: By using this format to complete the question: /* * Project10.java * * A program that plays and scores a round of the game Poker

By using this format to complete the question:

/* * Project10.java * * A program that plays and scores a round of the game Poker Dice. In this game, * five dice are rolled. The player is allowed to select a number of those five dice * to re-roll. The dice are re-rolled and then scored as if they were a poker hand. * The following hands MUST be scored in this assignment: * * High card * * One Pair * * Two Pair * * Three of a Kind * * Full House * * Four of a Kind * * Five of a Kind * For extra credit, you may also implement: * * Straight * * @author ENTER YOUR NAME HERE * */ package osu.cse1223; import java.util.Scanner; public class Project10 { public static void main(String[] args) { // Fill in the body } // Given an array of integers as input, sets every element of the array to zero. private static void resetDice(int[] dice) { // Fill in the body } // Given an array of integers as input, checks each element of the array. If the value // of that element is zero, generate a number between 1 and 10 and replace the zero with // it. Otherwise, leave it as is and move to the next element. private static void rollDice(int[] dice) { // Fill in the body } // Given an array of integers as input, create a formatted String that contains the // values in the array in the order they appear in the array. For example, if the // array contains the values [0, 3, 7, 5, 2] then the String returned by this method // should be "0 3 7 5 2". private static String diceToString(int[] dice) { // Fill in the body } // Given an array of integers and a Scanner as input, prompt the user with a message // to indicate which dice should be re-rolled. If the user enters a valid index (between // 0 and the total number of dice -1) then set the die at that index to zero. If the // user enters a -1, end the loop and return to the calling program. If the user enters // any other invalid index, provide an error message and ask again for a valid index. private static void promptForReroll(int[] dice, Scanner inScanner) { // Fill in the body } // Given a Scanner as input, prompt the user to play again. The only valid entries // from the user are 'Y' or 'N', in either upper or lower case. If the user enters // a 'Y' the method should return a value of true to the calling program. If the user // enters a 'N' the method should return a value of false. If the user enters anything // other than Y or N (including an empty line), an error message should be displayed // and the user should be prompted again until a valid response is received. private static boolean promptForPlayAgain(Scanner inScanner) { // Fill in body } // Given an array of integers, determines the result as a hand of Poker Dice. The // result is determined as: // * Five of a kind - all five integers in the array have the same value // * Four of a kind - four of the five integers in the array have the same value // * Full House - three integers in the array have the same value, and the remaining two // integers have the same value as well (Three of a kind and a pair) // * Three of a kind - three integers in the array have the same value // * Two pair - two integers in the array have the same value, and two other integers // in the array have the same value // * One pair - two integers in the array have the same value // * Highest value - if none of the above hold true, the Highest Value in the array // is used to determine the result // // The method should evaluate the array and return back to the calling program a String // containing the score from the array of dice. // // EXTRA CREDIT: Include in your scoring a Straight, which is 5 numbers in sequence // [1,2,3,4,5] or [2,3,4,5,6] or [3,4,5,6,7] etc.. private static String getResult(int[] dice) { // Fill in the body } // Given an array of integers as input, return back an array with the counts of the // individual values in it. You may assume that all elements in the array will have // a value between 1 and 10. For example, if the array passed into the method were: // [1, 2, 3, 3, 7] // Then the array of counts returned back by this method would be: // [1, 1, 2, 0, 0, 0, 1, 0, 0, 0] // (Where index 0 holds the counts of the value 1, index 1 holds the counts of the value // 2, index 2 holds the counts of the value 3, etc.) // HINT: This method is very useful for determining the score of a particular hand // of poker dice. Use it as a helper method for the getResult() method above. private static int[] getCounts(int[] dice) { // Fill in the body } } 

For this lab you will write a Java program that plays the game Poker Dice. In this game, five dice are rolled and scored as if they were a hand of playing cards. The game goes through two separate phases. In the first phase, a "hand" of dice is presented to the player. The player then selects which dice he wants to keep and which he wants to re-roll. Once that decision is finished, all of the dice that the player has marked to re-roll are re-rolled and the final "hand" of dice is displayed. The hand should then be scored according to the rules of Poker Dice (given below) and the result displayed on the screen.

Scoring Poker Dice

The following table shows the values of different Poker Dice hands in order (i.e. Five of a Kind beats Four of a Kind, Four of a Kind beats Full House, etc.):

Hand Description Examples
Five of a Kind All five dice show the same value [1, 1, 1, 1, 1] [5, 5, 5, 5, 5]
Four of a Kind Four of the five dice show the same value [1, 2, 1, 1, 1] [4, 4, 4, 3, 4]
Full House Three of the five dice show the same value, the other two show a different matched value [1, 2, 2, 1, 1] [3, 3, 3, 5, 5]
Three of a Kind Three of the five dice show the same value, the other two show different values [1, 2, 3, 1, 1] [3, 3, 3, 2, 5]
Straight All five dice together show a sequence of values 1-5 or 2-6 or 3-7 etc. [2, 3, 1, 5, 4] [6, 3, 2, 4, 5]
Two Pair Two of the five dice show the same value, and two other dice show a different shared value [1, 2, 2, 1, 3] [3, 5, 6, 3, 6]
One Pair Two of the five dice show the same value, the other dice show different values [1, 2, 2, 3, 4] [3, 5, 6, 3, 1]
Highest Card X If none of the above hands exist, then the score for the hand is "Highest Card X" where X is the highest value in the list

[1, 2, 3, 5, 7] - Highest Card 7 [1, 2, 8, 4, 5] - Highest Card 8

This is a sample transcript of what your program should do. Items in bold are user input and should not be put on the screen by your program. Your current dice: 4 2 1 4 6 Select a die to re-roll (-1 to keep remaining dice): 1 Your current dice: 4 0 1 4 6 Select a die to re-roll (-1 to keep remaining dice): 2 Your current dice: 4 0 0 4 6 Select a die to re-roll (-1 to keep remaining dice): 4 Your current dice: 4 0 0 4 0 Select a die to re-roll (-1 to keep remaining dice): -1 Keeping remaining dice... Rerolling... Your final dice: 4 2 3 4 6 One pair! Would you like to play again [Y/N]?: y

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!