ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 2 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 19 May 2017 My Price 9.00

Using enum types

Objectives

Using enum types.

To be able to build an application using arrays and enum types

 

Overview

The class PokerCard represents a common poker playing-card. In this implementation, the suit and rank of a playing-card are both represented by enum types, CardSuit and CardRank. You will implement 2 additional classes:

PokerDeck represents a deck of 52 PokerCards in 4 suits of 13 ranks each.

PokerHand represents a poker-hand of 5 PokerCards dealt from a PokerDeck.

 

The required representation of PokerDeck is non-traditional. Instead of an array of 52 PokerCard elements, it uses an array of 52 boolean elements. Each element corresponds to one of the 52 poker playing-cards: true if that card is in the deck, false if that card is not in the deck. Each group of 13 consecutive elements represents the cards of one suit:

0                                   12 13                                   25 26                                   38 39                                  51

CLUBS

DIAMONDS

HEARTS

SPADES

Within each suit, the array elements represent the playing-cards in rank order, thus:

2

3

4

5

6

7

8

9

T

J

Q

K

A

 

The PokerHand class is implemented using an array of 5 PokerCard elements.

 

Specific Requirements

The PokerCard class is already implemented. A client to test it is provided. Run the client and study the PokerCard code until you fully understand the implementation.

 

Complete the implementation of the PokerDeck class. A skeleton class with stubs of all the required methods is provided. Your implementation must

use the array representation described above,

use / and % to map an array index to CardSuit and CardRank ordinals,

use the ordinals to select from CardSuit.values() and CardRank.values() arrays.

A client to test your implementation is provided.

 

Complete the implementation of the PokerHand class. A skeleton class is provided.

Your addCard() method must insert the PokerCard being added to maintain the PokerHand in sorted order.

Your type() method’s algorithm must utilize the sorted order of a PokerHand.

Your type() method’s implementation must use a helper method(s) for each hand-type being tested.

 A client to test your implementation is provided.

Document your program

Include a Program Id Paragraph into both source files

Provide helpful comments

Answers

(11)
Status NEW Posted 19 May 2017 08:05 AM My Price 9.00

-----------

Not Rated(0)