Question: IT'S A ' C SHARP C# ' QUESTION Consider the following UML diagram: Card > SetOfCards #_cards: List #_max: int > + Cards: List +

IT'S A ' C SHARP C# ' QUESTION

IT'S A ' C SHARP C# ' QUESTION Consider the following UML

diagram: Card > SetOfCards #_cards: List #_max: int > + Cards: List

+ SetOfCards() + addCard(...) + evaluate() + toString() - _suit: Suit -

_rank: Rank > + Suit: Suit > + Rank: Rank 1 contains

+ Card(...) + ToString() Deck Hand + Deck() - CreateCards ) +

Shuffle() + Deal) + Hand) + Hand ...) + ToString() Enums Rank:

that includes the 13 ranks of a deck of playing cards: two,

three... ten, jack, queen, king, ace Suit: that includes the suits of

Consider the following UML diagram: Card > SetOfCards #_cards: List #_max: int > + Cards: List + SetOfCards() + addCard(...) + evaluate() + toString() - _suit: Suit - _rank: Rank > + Suit: Suit > + Rank: Rank 1 contains + Card(...) + ToString() Deck Hand + Deck() - CreateCards ) + Shuffle() + Deal) + Hand) + Hand ...) + ToString() Enums Rank: that includes the 13 ranks of a deck of playing cards: two, three... ten, jack, queen, king, ace Suit: that includes the suits of a deck of playing cards: clubs, spades, hearts, diamonds - in this assignment, Ace only has a high value i.e. higher than King, not lower than 2) The Card class has fields _suit and a _rank of types Suit and Rank, respectively. include one constructor: full-arg that assigns the passed suit and rank Create a property for each field and override the toString method to return a string in the format of of , of , of , ... of ] Subclasses Deck and Hand extend the SetofCards class a) Include the following methods in the Deck class: a no-arg constructor that assigns the max to 52 and creates the deck Include a private utility CreateCards () that creates and adds all 52 cards in a deck (i.e. each_rank of each suit). Call this method in the constructor. Shuffle () that randomly orders the cards. Note that C# does not have a built-in Shuffle utility, you will have to write your own Deal() removes and returns the first card of the deck Evaluate() that returns a simple string that displays the number of cards in the deck Include the following methods in the Hand class: a no-arg constructor that assigns the max to 5 Evaluate() that returns a String that represents the hand: Flush - all cards have the same suit Straight - five cards of consecutive rank of any suit Straight Flush-five cards of consecutive rank of the same suit One Pair - two cards of one rank and three cards of three other ranks Two Pair - two cards of one rank, two cards of another rank and one card of a third rank Three of a Kind - three cards of one rank and two cards of two other ranks Four of a Kind - four cards of one rank and one card of another rank Full House - One Pair + Three of a kind Nothing ( High) - none of the above results but indicates the highest rank in the hand i.e Nothing (ACE High) Any additional private utility methods called in Evaluate to determine the hand status e.g. CheckFlush(), etc. Include a driver class called PokerHandSim that simulates the dealing of 4 hands from a deck of cards and displays the result of each - Create an instance of a deck Shuffle the deck of cards, then simulate the initial hand of poker for 4 players: For each player: deal 5 cards from the deck to create a hand display the cards of the hand and result of the hand Sample output: Poker simulation - initial hand: Player 1: [SIX of CLUBS, FOUR of DIAMONDS, ACE of CLUBS, THREE of DIAMONDS, EIGHT of DIAMONDS] Nothing (ACE high) Player 2: [TEN of SPADES, KING of HEARTS, NINE of SPADES, SIX of DIAMONDS, TWO of CLUBS] Nothing (KING high) Player 3: [EIGHT of CLUBS, QUEEN of HEARTS, QUEEN of DIAMONDS, QUEEN of SPADES, TWO of DIAMONDS] Three of a kind Player 4: [EIGHT of SPADES, JACK of DIAMONDS, THREE of SPADES, TEN of CLUBS, JACK of HEARTS] One Pair Number of cards in deck: 32 Notes: Auxiliary arrays and Lists may be used throughout the program, _cards must be of type List Additional cases (all possible hand results, adding more than max number of cards, etc.) will be tested by the marker Use the index of values of the basic enum

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!