Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

NEED HELP IN ZYBOOKS STYLE JAVA PLEASE!!! STEP BY STEP IF POSSIBLE THANK YOU!!! 6.26 LAB*: Program: Poker dice game Program Specifications Write a program

NEED HELP IN ZYBOOKS STYLE JAVA PLEASE!!!

STEP BY STEP IF POSSIBLE THANK YOU!!!

6.26 LAB*: Program: Poker dice game

Program Specifications 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 0. 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 1 (3 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 1 - 6. Return the highest score from all method calls. Submit for grading to confirm two tests pass.

Ex: If input is:

2 4 1 5 4 

the output is:

High score: 8 

Step 2 (3 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 30 from checkThreeOfKind() if the dice contain at least three of the same values. Ex: (2, 3, 3, 3, 6). Return 40 from checkFourOfKind() if the dice contain at least four of the same values. Ex: (4, 4, 4, 4, 5). Return 50 from checkFiveOfKind() if the dice contain five identical values. Ex: (5, 5, 5, 5, 5). 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:

2 4 4 5 4 

the output is:

High score: 30 

Step 3 (2 pts). Complete the checkFullHouse() method to return 35 if the dice contain a full house (a pair and three of a kind). Ex: (1, 1, 3, 3, 3). Note: Five of a kind also satisfies the definition of a full house since (4, 4, 4, 4, 4) includes a pair of 4s and three 4s. 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 4 (2 pts). Complete the checkStraight() method to return 45 if the dice contain a straight of (1, 2, 3, 4, 5) or (2, 3, 4, 5, 6). Update the findHighScore() method to call checkStraight() and return the highest score from all method calls. Submit for grading to confirm all tests pass.

CODE GIVEN:

image text in transcribed

image text in transcribed

image text in transcribed

LabProgram.java Load default template... Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box. Enter program input (optional)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago