Yahtzee program.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Can someone please help me with the following coding given based on the instructions (//*** in bold)? I am not sure on how to go about it here. Just as a side note, this is coding that is going to be used for a working Yahtzee program. I am also using the IntelliJ IDEA application for this code. Thanks for the help!

//***
//*** INSTRUCTIONS FOR CODE FOR YOU TO WRITE
//***
//*** 1) Replace these six if-else structures with the code in Steps 2 & 3:
//***
//***     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);
//***
//***     if (twos == SCORE_NO_VALUE)
//***         System.out.println(SECOND_OPTION_LABEL + OPTION_SUFFIX_ONE_DIGIT + TWOS_LABEL);
//***     else
//***         System.out.println(SECOND_OPTION_LABEL + OPTION_SUFFIX_ONE_DIGIT + TWOS_LABEL + EQUALS_LABEL + twos);
//***
//***     if (threes == SCORE_NO_VALUE)
//***         System.out.println(THIRD_OPTION_LABEL + OPTION_SUFFIX_ONE_DIGIT + THREES_LABEL);
//***     else
//***         System.out.println(THIRD_OPTION_LABEL + OPTION_SUFFIX_ONE_DIGIT + THREES_LABEL + EQUALS_LABEL + threes);
//***
//***     if (fours == SCORE_NO_VALUE)
//***         System.out.println(FOURTH_OPTION_LABEL + OPTION_SUFFIX_ONE_DIGIT + FOURS_LABEL);
//***     else
//***         System.out.println(FOURTH_OPTION_LABEL + OPTION_SUFFIX_ONE_DIGIT + FOURS_LABEL + EQUALS_LABEL + fours);
//***
//***     if (fives == SCORE_NO_VALUE)
//***         System.out.println(FIFTH_OPTION_LABEL + OPTION_SUFFIX_ONE_DIGIT + FIVES_LABEL);
//***     else
//***         System.out.println(FIFTH_OPTION_LABEL + OPTION_SUFFIX_ONE_DIGIT + FIVES_LABEL + EQUALS_LABEL + fives);
//***
//***     if (sixes == SCORE_NO_VALUE)
//***         System.out.println(SIXTH_OPTION_LABEL + OPTION_SUFFIX_ONE_DIGIT + SIXES_LABEL);
//***     else
//***         System.out.println(SIXTH_OPTION_LABEL + OPTION_SUFFIX_ONE_DIGIT + SIXES_LABEL + EQUALS_LABEL + sixes);
//***
//*** 2) In place of the code in Step 1, write a for-loop that iterates "number of items in upper section category" times.
//***
//*** Hint: There is a constant already defined for "number of items in upper section category" that you must use.
//***
//*** 3) Code block for the for-loop in Step 2:
//***     A) Using the for-loop's control variable as an index into array variable "scores", write an if-statement that checks the value of each upper category score element in the array variable "scores" for "equality to" SCORE_NO_VALUE.
//***     B) If the condition in Step 3A evaluates to true, then the category has not been used, therefore do the following:
//***          a) Code block if Step 3A evaluates to true:
//***               1) Write a println statement that displays the menu option using the for-loop's control variable in displaying both the menu number and the associated value in array constant "labels".
//***          b) Code block when Step 3A evaluates to false (else-statement):
//***               1) Write a println statement that displays the menu option using the for-loop's control variable in displaying: the menu number, the associated value in array constant "labels", and the associated score value stored in array variable "scores".
//***
//*** NOTE: 1) Array variable "scores" replaces all of the individual score variables (e.g. aces, twos, etc).
//***             2) Array constant "labels" replaces all of the individual label constants (e.g. ACES_LABEL, TWOS_LABEL, etc).
//***             3) You are replacing the six if-else structures that use the individual score variables with a for-loop that contains a nested if-else structure that references into array variable "scores" and array constant "labels".
//***
//*** This can be as few as five lines of code not including any curly braces.
//***

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY