From 034bb62ab16ef003865727beeeceb084a7f694f8 Mon Sep 17 00:00:00 2001 From: Mohammad-Ali Date: Mon, 20 May 2019 19:30:38 -0400 Subject: [PATCH] Added the deal method i added the deal method which should have been completed in this activity as indicated by the comment i removed --- Activity-2/Deck.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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.