import java.util.List; import java.util.ArrayList; public class Pile { protected List l; //constructor for the arraylist and assigns l to new empty list public Pile() { this.l = new ArrayList(); } //returns list l public Pile(List l) { this.l = l; } //returns the size of the list public int size() { return l.size(); } //adds all the cards on the top of the deck //starting at the position 0 public void addTop(List cards) { l.addAll(0,cards); } //adds the card at the rank in the list public void addTop(Card c) { l.add(0,c); } //remove the top of the card public Card removeTop() { return (Card)l.remove(0); } //keep on removing the top...of the deck //specified by the number n...removeTop(3).. //removes 3 cards  public List removeTop(int n) { ArrayList top = new ArrayList(); for (int i=0; i 0; i++) top.add(l.remove(0)); return top; } public Card viewCard(int n) { return (Card)l.get(n); } public String toString() { return l.toString(); } }