import java.util.*;
import java.lang.*;

class Main {
    public static void main(String[] args) {
        Deck deck = new Deck();
        for (int i = 0 ; i != 52 ; i++) {
            Card playerCard = deck.takeRandomCard();
            System.out.println("The card is: " + playerCard.toString());
        }
    }
}

class Deck {
    private static final int HIGH_SUIT=3;
    private static final int HIGH_VALUE=12;
    private boolean[] taken = new boolean[52];
    int cardCount = 52;
    Card[] fullDeck = new Card[52]; 

    public Deck() {
        int i = 0;
        for(int s = 0; s <= HIGH_SUIT; s++) {
            //for loop to determine the suit
            for (int v = 0; v <= HIGH_VALUE; v++) {
                //construct all 52 cards and print them out 
                fullDeck[i++] = new Card(s, v);
            }
        }
    }

    public Card takeRandomCard() {
        if (cardCount == 0) return null;
        int r;
        do {
            r = (int)(Math.random() * 52);
        } while (taken[r]);
        taken[r] = true;
        cardCount--;
        return fullDeck[r];
    }
}

class Card {
    private int cardValue; 
    private String cardSuit;
    private String stringValue;
    static final String[] SUIT = {"Clubs", "Diamonds", "Hearts", "Spades"}; 
    static final String[] VALUE =  {"Ace","Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"}; 


    public Card (int cardS, int cardV) {
        cardSuit = SUIT[cardS]; 
        stringValue = VALUE[cardV];
    }

    public String getCardSuit() {
        return cardSuit;
    }

    public String getValue() {
        return stringValue;
    }

    public String toString() {
        return String.format("%s of %s", stringValue, cardSuit);
    }
}
