
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. Could you also add comments to each line of code when you write out the codes for this as welI? 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:
public static void displayScoreSheet() {
final String ACES_LABEL = "Aces";
final String TWOS_LABEL = "Twos";
final String THREES_LABEL = "Threes";
final String FOURS_LABEL = "Fours";
final String FIVES_LABEL = "Fives";
final String SIXES_LABEL = "Sixes";
final String THREE_KIND_LABEL = "3 of a kind";
final String FOUR_KIND_LABEL = "4 of a kind";
final String FULL_HOUSE_LABEL = "Full House";
final String SMALL_STRAIGHT_LABEL = "Sm. Straight";
final String LARGE_STRAIGHT_LABEL = "Lg. Straight";
final String YAHTZEE_LABEL = "YAHTZEE";
final String CHANCE_LABEL = "Chance";
final String YAHTZEE_BONUS_LABEL = "YAHTZEE BONUS";
final int BONUS_THRESHOLD = 63;
final int BONUS_SCORE = 35;
final String UPPER_SECTION_LABEL = "UPPER SECTION";
final String LOWER_SECTION_LABEL = "LOWER SECTION";
final String UPPER_SECTION_SUBTOTAL_LABEL = "TOTAL SCORE";
final String UPPER_SECTION_BONUS_LABEL = "BONUS if >= 63";
final String UPPER_SECTION_TOTAL_LABEL = "TOTAL of Upper Section";
final String LOWER_SECTION_TOTAL_LABEL = "TOTAL of Lower Section";
final String GRAND_TOTAL_LABEL = "GRAND TOTAL";
final String OPTION_SUFFIX_ONE_DIGIT = ") ";
final String OPTION_SUFFIX_TWO_DIGIT = ") ";
final String FIRST_OPTION_LABEL = "1";
final String SECOND_OPTION_LABEL = "2";
final String THIRD_OPTION_LABEL = "3";
final String FOURTH_OPTION_LABEL = "4";
final String FIFTH_OPTION_LABEL = "5";
final String SIXTH_OPTION_LABEL = "6";
final String SEVENTH_OPTION_LABEL = "7";
final String EIGHTH_OPTION_LABEL = "8";
final String NINTH_OPTION_LABEL = "9";
final String TENTH_OPTION_LABEL = "10";
final String ELEVENTH_OPTION_LABEL = "11";
final String TWELFTH_OPTION_LABEL = "12";
final String THIRTEENTH_OPTION_LABEL = "13";
final String EQUALS_LABEL = " = ";
int upperScoreTotal;
upperScoreTotal = calculateUpperScore();
int lowerScoreTotal;
lowerScoreTotal = calculateLowerScore();
System.out.println();
System.out.println(UPPER_SECTION_LABEL);
if (aces == SCORE_NO_VALUE)
System.out.println(FIRST_OPTION_LABEL + OPTION_SUFFIX_ONE_DIGIT + ACES_LABEL);
else
System.out.println(FIRST_OPTION_LABEL + OPTION_SUFFIX_ONE_DIGIT + ACES_LABEL + EQUALS_LABEL + aces);
* The if-else statement continues the same way for "twos," "threes," "fours," "fives," and sixes."
if (upperScoreTotal > 0)
System.out.println(UPPER_SECTION_SUBTOTAL_LABEL + EQUALS_LABEL + upperScoreTotal);
else
System.out.println(UPPER_SECTION_SUBTOTAL_LABEL);
if (upperScoreTotal >= BONUS_THRESHOLD)
System.out.println(UPPER_SECTION_BONUS_LABEL + EQUALS_LABEL + BONUS_SCORE);
else
System.out.println(UPPER_SECTION_BONUS_LABEL);
if (upperScoreTotal > 0)
if (upperScoreTotal >= BONUS_THRESHOLD)
System.out.println(UPPER_SECTION_TOTAL_LABEL + EQUALS_LABEL + (upperScoreTotal + BONUS_SCORE));
else
System.out.println(UPPER_SECTION_TOTAL_LABEL + EQUALS_LABEL + upperScoreTotal);
else
System.out.println(UPPER_SECTION_TOTAL_LABEL);
System.out.println();
System.out.println(LOWER_SECTION_LABEL);
//***
//*** INSTRUCTIONS FOR CODE FOR YOU TO WRITE
//***
//*** 1) Following the form of the if-statement-block for option Aces (shown above):
//*** A) Write seven (7) if-statement-blocks that check the following variables for "equality to" SCORE_NO_VALUE:
//*** a) "threeKind"
//*** b) "fourKind"
//*** c) "fullHouse"
//*** d) "smallStraight"
//*** e) "largeStraight"
//*** f) "yahtzee"
//*** g) "chance"
//*** B) Use the correct Java syntax for the "equality" operator.
//***
//*** NOTE: 1) Don't forget to use the different OPTION_LABEL constants when writing the code for Step 1.
//*** 2) Starting with the tenth option (which should be Small Straight), use OPTION_SUFFIX_TWO_DIGIT for good text alignment.
//***
//*** Your code for Step 1 goes here.
//***

Trending nowThis is a popular solution!
Step by stepSolved in 4 steps

- THIS IS MEANT TO BE IN JAVA. What we've learned so far is variables, loops, and we just started learning some array today. The assignment is to get an integer from input, and output that integer squared, ending with newline. But i've been given some instructions that are kind of confusing to me. Please explain why and please show what the end result is. Here are some extra things i've been told to do with the small amount of code i've already written... Type 2 in the input box, then run the program so I can note that the answer is 4 Type 3 in the input box instead, run, and note the output is 6. Change the output statement to output a newline: System.out.println(userNumSquared);. Type 2 in the input box Change the program to use * rather than +, and try running with input 2 (output is 4) and 3 (output is now 9, not 6 as before). This is what I have so far... import java.util.Scanner; public class NumSquared {public static void main(String[] args) {Scanner scnr = new…arrow_forwardI need help with the content on the image below. The Code is Java.arrow_forwardNOTE: Please do not copy from another person's answer, if you do so, you will be given down vote/thumb down. Thank you! Also, No entire code is needed. Just provide the method for LList class in Java ------------------------------------------------------------------------------------------------------------------------------------------------------- Suppose that a list contains Comparable objects. Implement a method that returns a new list of items that are less than some given item. The header of the method could be as follows: public LList<T> getAllLessThan( Comparable<T> anObject) Write an implementation of this method for the class LList. Make sure that your method does not affect the state of the original list.arrow_forward
- I didn't understand the previous code and it didn't run to my software . can you do it again? I use intelliJ IDE to code in JAVA. Thank youarrow_forwardI was asked to add the three types of comments to this class, each consisting of the same statement (this statement is also printed once). The output/print, block comment, and single line comment has all been marked correct. The Javadoc comment, however, has not. I asked this question earlier and tried implementing that solution, however, it did not work. What should I do to make it work?arrow_forwardGrey lines of code can NOT be edited. NEW JAVA code inbetween lines 11 - 14 in photo. TIP:arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





