Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project4 Specifications: Determine Poker Hand (Visual Basic) A poker hand can be stored in a two-dimensional array. The statement: Dim aryintCards(4,14) as Integer (See AryCardExample.xlsx

image text in transcribedimage text in transcribedProject4 Specifications: Determine Poker Hand (Visual Basic)

A poker hand can be stored in a two-dimensional array. The statement:

Dim aryintCards(4,14) as Integer

(See AryCardExample.xlsx excel spreadsheet)

declares an array which the first subscript 1-4 are the four suits and

the second subscript ranges over the card denominations: 1-14: Ace, 2,

..., 10, Jack, Queen, King, Ace (repeated). First subscript of 0 is

Total of each denomination. Second subscript of 0 is Total of each

suit. Using these totals can determine what hand has been selected.

Write a program that requests the five cards as input from the user,

creates the related array, totals the special 0 rows and columns, uses

those total to determine the type of hand. Poker hands are:

Deck of Cards: 52 cards.

4 suits: Hearts, Spades, Clubs, Diamonds

13 cards per suit: 2,3,4,5,6,7,8,9,10,Jack,Queen,King,Ace( or 1)

5 Card Stud Poker (no Draws)

Poker Hands - From Greatest to Least:

Royal Flush - Ace, King, Queen, Jack, 10 of the same Suit

Straight Flush - any straight with same suit.

Four of Kind - 4 of the same value

Full House - 3 of same value and 2 of another same value

Flush - all of the same suit.

Straight - sequentially in order none missing any suit.

Three of A Kind - 3 of same value

Two Pair - 2 pairs of the same value

One Pair - 1 pair of the same value

Nothing

***************************************************************************

After you press " show poker hand," a window pops up saying" straight flush"

image text in transcribed

SAMPLE DESIGN DOCUMENT Meaning: TotalCol Card#6 Card#7 Card10Cardlack CardQueen CardkKing 10 12 13 14 Clubs Color Meanings: Yellow is 52 cards which are selected by user; Gray: Total calculated for that suit (row); Orange: Total calculated for that card value (Col); Green: Only used in straights Dim aryintCards(4,14) As Integer As illustrated a When user clicks on a card, must translate that card to an(x,y) index into array. If selecting that card place a 1 at array element, if un-selecting that card place a O at array element. Translation use Tag property of checkbox: x.y (write function to extract x and y) Steps to determine hand 1) Ensure that exactly five cards are selected before preceeding 2) Total the rows and columns: For rows aryintCards(i,0) 0 to clear each row's total value in column 0 of that row (4 rows 1-4) Add the values from column 1 to 13 (don't do 14 because it's included in column 1) Before next step: copy values from CardAce(i,1 to (,14 to handle Ace being High. Add the values from row 1 to 4 (include all columns 1 to 14) aryintCards(i,0)aryintCards(i.j) For cols: aryintCards(0j) 0 to clear each col's total vatue in row 0 of that cotumn (14 cols 1-14). aryintCards(0,j) aryintCards(.j) 3) Flush functio Check each aryintCards(i,0) value if its 5 must be a flush If its a flush, Check straight function to determine if its a straight flush. If straight flush check Royal function to determine if its a royal flush 4) Straight function: Starting at Column 1 and going to column 10, check next 5 cols TotalCols row for all being 1's IE: tf (0,j+0#1 And (0,j+1)-1 And (0,j+2)-1 And (0.j+3)-1 And (Oj+4)s1 If all 5 are 1 then must be a straight. SAMPLE DESIGN DOCUMENT Meaning: TotalCol Card#6 Card#7 Card10Cardlack CardQueen CardkKing 10 12 13 14 Clubs Color Meanings: Yellow is 52 cards which are selected by user; Gray: Total calculated for that suit (row); Orange: Total calculated for that card value (Col); Green: Only used in straights Dim aryintCards(4,14) As Integer As illustrated a When user clicks on a card, must translate that card to an(x,y) index into array. If selecting that card place a 1 at array element, if un-selecting that card place a O at array element. Translation use Tag property of checkbox: x.y (write function to extract x and y) Steps to determine hand 1) Ensure that exactly five cards are selected before preceeding 2) Total the rows and columns: For rows aryintCards(i,0) 0 to clear each row's total value in column 0 of that row (4 rows 1-4) Add the values from column 1 to 13 (don't do 14 because it's included in column 1) Before next step: copy values from CardAce(i,1 to (,14 to handle Ace being High. Add the values from row 1 to 4 (include all columns 1 to 14) aryintCards(i,0)aryintCards(i.j) For cols: aryintCards(0j) 0 to clear each col's total vatue in row 0 of that cotumn (14 cols 1-14). aryintCards(0,j) aryintCards(.j) 3) Flush functio Check each aryintCards(i,0) value if its 5 must be a flush If its a flush, Check straight function to determine if its a straight flush. If straight flush check Royal function to determine if its a royal flush 4) Straight function: Starting at Column 1 and going to column 10, check next 5 cols TotalCols row for all being 1's IE: tf (0,j+0#1 And (0,j+1)-1 And (0,j+2)-1 And (0.j+3)-1 And (Oj+4)s1 If all 5 are 1 then must be a straight

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_2

Step: 3

blur-text-image_3

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions