/**
 *  Represents a generic deck of cards.
 */

/*

Tips:

- Use an ArrayList<Card> to hold the cards.
- Add and remove cards at the end of the list.
- Use Collections.shuffle and Collections.sort to shuffle and sort the deck,
or write your own methods.  If you write your own, use selection sort
to sort and a similar algorithm to shuffle.  Use Math.random().
- In the toString method, separate strings for individual cards with "\n".

 */

import java.util.*;

public class Deck
{
    ArrayList<Card> deque;
    String something="";

    public Deck(){

        deque = new ArrayList<Card>();

    }

    public Deck(int capacity){

        deque = new ArrayList<Card>(capacity);

    }

    public int getNumCards(){
        return deque.size();
    }

    public boolean isEmpty(){
        if(deque.size()==0){
            return true;
        }
        else{
            return false;
        }
    }
    
    public void add(Card card){
        deque.add(card);
    }

    public Card takeTop(){
        
        return deque.remove(deque.size()-1);

    }

    public void shuffle(){
        
        Collections.shuffle(deque);
    }

    public void sort(){
     
        Collections.sort(deque);
    }

    public String toString(){
        for (int i = 0; i<deque.size(); i++)
        {
            something += takeTop() + "\n";
        }
        return something;
    }

}

@@ -1050,32 +1050,58 @@
 Top()%7B%0D%0A        
+if (!isEmpty())%0D%0A        %7B
 %0D%0A        return
@@ -1086,32 +1086,36 @@
      %7B%0D%0A        
+    
 return deque.rem
@@ -1132,24 +1132,95 @@
 size()-1);%0D%0A
+        %7D%0D%0A        else%0D%0A        %7B%0D%0A            return null;%0D%0A        %7D
 %0D%0A    %7D%0D%0A%0D%0A 

there aN IF STATEMENT