Hello! I am having trouble on how to write out the Java code based on the instructions (in bold //***) that I am given. As a note, this specific Java code is a code that is going to setup the basic framework for a game of Yahtzee. In other words, you will need to understand the rules of Yahtzee and implement the rules into coding. I appreciate the help. Thanks! Also, I am using the IntelliJ IDEA application when writing out this program. Here is what I need help with: * The code given below is going to be modified based on the instructions in bold. public static int calculateFourOfKind() { int score; score = 0; boolean isFourKind; isFourKind = false; System.out.println("In method calculateFourOfKind"); return score; //*** //*** INSTRUCTIONS FOR CODE FOR YOU TO WRITE //*** //*** Modify your "calculateFourOfKind" method as follows: //*** 1) Remove the System.out.println statement. //*** //*** 2) Create an if-else-if structure to determine if the five (5) dice form a valid four-of-a-kind. //*** A) You MUST use an if-else-if structure. //*** B) Your if-statement conditions MUST be compound Boolean expressions. In other words, the //*** if-statement conditions must have multiple expressions joined by && (AND) or || (OR) //*** operators. //*** //*** 3) In your if-else-if structure, if it is determined that the configuration of the dice form a valid //*** four-of-a-kind, then assign the value of true to the variable "isFourKind". //*** //*** 4) Write an if-statement that checks if variable "isFourKind" is true. //*** //*** 5) Code block for if-statement in Step 4: //*** A) Add the values of variables "die1", "die2", "die3", "die4", and "die5" together and assign //*** that value to variable "score". //*** //*** 6) Keep the return statement that returns the variable "score". //*** //*** Hint: Here are the combinations of dice that form a valid four-of-a-kind: //*** 1) Variables "die1", "die2", "die3" and "die4" are equal //*** 2) Variables "die1", "die2", "die3" and "die5" are equal //*** 3) Variables "die1", "die2", "die4" and "die5" are equal //*** 4) Variables "die1", "die3", "die4" and "die5" are equal //*** 5) Variables "die2", "die3", "die4" and "die5" are equal //***
Hello! I am having trouble on how to write out the Java code based on the instructions (in bold //***) that I am given. As a note, this specific Java code is a code that is going to setup the basic framework for a game of Yahtzee. In other words, you will need to understand the rules of Yahtzee and implement the rules into coding. I appreciate the help. Thanks! Also, I am using the IntelliJ IDEA application when writing out this program. Here is what I need help with:
* The code given below is going to be modified based on the instructions in bold.
public static int calculateFourOfKind() {
int score;
score = 0;
boolean isFourKind;
isFourKind = false;
System.out.println("In method calculateFourOfKind");
return score;
//***
//*** INSTRUCTIONS FOR CODE FOR YOU TO WRITE
//***
//*** Modify your "calculateFourOfKind" method as follows:
//*** 1) Remove the System.out.println statement.
//***
//*** 2) Create an if-else-if structure to determine if the five (5) dice form a valid four-of-a-kind.
//*** A) You MUST use an if-else-if structure.
//*** B) Your if-statement conditions MUST be compound Boolean expressions. In other words, the //*** if-statement conditions must have multiple expressions joined by && (AND) or || (OR) //*** operators.
//***
//*** 3) In your if-else-if structure, if it is determined that the configuration of the dice form a valid //*** four-of-a-kind, then assign the value of true to the variable "isFourKind".
//***
//*** 4) Write an if-statement that checks if variable "isFourKind" is true.
//***
//*** 5) Code block for if-statement in Step 4:
//*** A) Add the values of variables "die1", "die2", "die3", "die4", and "die5" together and assign //*** that value to variable "score".
//***
//*** 6) Keep the return statement that returns the variable "score".
//***
//*** Hint: Here are the combinations of dice that form a valid four-of-a-kind:
//*** 1) Variables "die1", "die2", "die3" and "die4" are equal
//*** 2) Variables "die1", "die2", "die3" and "die5" are equal
//*** 3) Variables "die1", "die2", "die4" and "die5" are equal
//*** 4) Variables "die1", "die3", "die4" and "die5" are equal
//*** 5) Variables "die2", "die3", "die4" and "die5" are equal
//***
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)