diff --git a/Activity-2/Deck.java b/Activity-2/Deck.java index 5af29aa..035f070 100644 --- a/Activity-2/Deck.java +++ b/Activity-2/Deck.java @@ -51,10 +51,17 @@ public void shuffle() { * @return the card just dealt, or null if all the cards have been * previously dealt. */ + public Card deal() { - /* *** TO BE IMPLEMENTED IN ACTIVITY 2 *** */ + if (isEmpty()) + return null; + else { + size--; + return cards.get(size); + } } + /** * Generates and returns a string representation of this deck. * @return a string representation of this deck.