Presentation is loading. Please wait.

Presentation is loading. Please wait.

o Simulate a deck of playing cards o Shuffle the deck o Deal 5 cards into the hand o Turn over the first card o The user must guess whether the next card.

Similar presentations


Presentation on theme: "o Simulate a deck of playing cards o Shuffle the deck o Deal 5 cards into the hand o Turn over the first card o The user must guess whether the next card."— Presentation transcript:

1

2 o Simulate a deck of playing cards o Shuffle the deck o Deal 5 cards into the hand o Turn over the first card o The user must guess whether the next card is higher or lower o Turn over the next card o If the user guesses correctly, the game continues o If the user guesses correctly 4 times, the game is over and the user wins oIf the user guesses incorrectly, the game ends

3 Card Class Face Suit Rank is based upon the Face Implements the Comparable Interface Methods Constructor public String getFace() public String getSuit() public int getRank() public int compareTo(Object other)

4 Hand Class Represented as an array or as an ArrayList Methods Constructor public int getSize() public void addCard(Card c) public Card getCard(int i) private void changeCard(int pos,Card c) public void sort() private int findLowestIndex(int startIndex) public void printHand()

5 CardDeck Class Represented as a two-dimensional array of Card objects Methods Constructor public void shuffle() public Card deal() public void printDeck()

6 The User Clicks Higher

7 The User Clicks Lower

8 The User Clicks Higher

9 The User Is Wrong! Game Over

10 Blackjack War Games that use different card decks Extend the CardDeck class Games where Card ranks are different Extend the Card class


Download ppt "o Simulate a deck of playing cards o Shuffle the deck o Deal 5 cards into the hand o Turn over the first card o The user must guess whether the next card."

Similar presentations


Ads by Google