Question: Write a program to calculate the score from a throw of five dice. Scores are assigned to different categories for singles , three of a
Write a program to calculate the score from a throw of five dice. Scores are assigned to different categories for singles three of a kind, four of a kind, five of a kind, full house, and straight. Follow each step to gradually complete all methods.
Note: This program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress.
Step Review the provided main method. Five integer values are input and inserted into an array. The array is sorted and passed to findHighScore to determine the highest scoring category. Make no changes to main Stubs are provided for all remaining methods.
Step pts Complete the checkSingles method. Return the sum of all values that match parameter goal. Update the findHighScore method to use a loop to call checkSingles six times with parameters of Return the highest score from all method calls. Submit for grading to confirm two tests pass.
Ex: If input is:
the output is:
High score:
Step pts Complete the checkThreeOfKind checkFourOfKind and checkFiveOfKind methods. Hint: Since the values are in ascending order, same values are stored in consecutive index locations. Return from checkThreeOfKind if the dice contain at least three of the same values. Ex: Return from checkFourOfKind if the dice contain at least four of the same values. Ex: Return from checkFiveOfKind if the dice contain five identical values. Ex: Update the findHighScore method to call the three methods and return the highest score from all method calls. Submit for grading toWrite a program to calculate the score from a throw of five dice. Scores are assigned to different categories for singles three of a kind, four of a kind, five of a kind, full house, and straight. Follow each step to gradually complete all methods.
Note: This program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress.
Step Review the provided main method. Five integer values are input and inserted into an array. The array is sorted and passed to findHighScore to determine the highest scoring category. Make no changes to main Stubs are provided for all remaining methods.
Step pts Complete the checkSingles method. Return the sum of all values that match parameter goal. Update the findHighScore method to use a loop to call checkSingles six times with parameters of Return the highest score from all method calls. Submit for grading to confirm two tests pass.
Ex: If input is:
the output is:
High score:
Step pts Complete the checkThreeOfKind checkFourOfKind and checkFiveOfKind methods. Hint: Since the values are in ascending order, same values are stored in consecutive index locations. Return from checkThreeOfKind if the dice contain at least three of the same values. Ex: Return from checkFourOfKind if the dice contain at least four of the same values. Ex: Return from checkFiveOfKind if the dice contain five identical values. Ex: Update the findHighScore method to call the three methods and return the highest score from all method calls. Submit for grading to confirm five tests pass.
Ex: If input is:
the output is:
High score:
Step pts Complete the checkFullHouse method to return if the dice contain a full house a pair and three of a kind Ex: Note: Five of a kind also satisfies the definition of a full house since includes a pair of s and three s Update the findHighScore method to call checkFullHouse and return the highest score from all method calls. Submit for grading to confirm seven tests pass.
Step pts Complete the checkStraight method to return if the dice contain a straight of or Update the findHighScore method to call checkStraight and return the highest score from all method calls. Submit for grading to confirm all tests pass.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
