Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLESE CODE IN C# ( C SHARP) Consider the following UML diagram: Card > SetOfCards #_cards: List #_max: int > + Cards: List + SetOfCards()

PLESE CODE IN C# ( C SHARP)

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

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

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

Do they ever feel that their personal life is being shortchanged?

Answered: 1 week ago

Question

=+10. How are inflation and unemployment related in the short run?

Answered: 1 week ago

Question

=+8. Why is productivity important?

Answered: 1 week ago