A deck of cards contains 52 cards. Each card has a suit (Clubs,Diamonds,Hearts,Spades) and a
value (Ace,2,3,...,9,10,Jack,Queen,King).
In the game of bridge a hand consists of 13 cards from the deck.
A player needs to evaluate his hand, giving it a point value. The standard
method is as follows: count 4 points for each Ace, 3 points for each King,
2 points for
each Queen, and 1 point for each Jack. For each suit, count 1 point if the
hand contains exactly two cards of that suit, 2 points if exactly one card, and
3 points if the hand contains no cards of that suit. The point value of the
hand is the sum of all these points.
Create a class BridgePts that contains a method pointValue that is given a int[]
hand and that returns the point value of the hand.
Each element of hand indicates a card. The clubs are numbered 1 to 13, the
diamonds are 14 to 26, the hearts are numbered 27 to 39, and the spades are
numbered 40 to 52. Within each suit, the cards are numbered in the order
Ace, 2, 3, ..., 9, 10, Jack, Queen, King. So, for example, the King of Hearts
is numbered 39 and the Ace of Spades is numbered 40.
|