public class Card
{
  private int value; //1 -- 13
  private char suit; // 'C' 'D' 'H' 'S' 

  public Card(int val, char s) 
  {
    if(val >= 1 && val <= 13)
    {
      this.value = val;
    }
    else
    {
      throw new IllegalArgumentException(val + " is not a legal value.");
    }
    if(s >= 'a' && s <= 'z')
    {
      s = (char)((int)s - ((int)'a' - (int)'A'));
    }
//at this point, if s is a letter, it is upper case
    if(s == 'C' || s == 'D' || s == 'H' || s == 'S')
    {
      this.suit = s;
    }
    else
    {
      throw new IllegalArgumentException(s + " is not a valid case.");
    }
  }

  public int getValue()
  {
    return this.value;
  }

  public char getSuit()
  {
    return this.suit;
  }

  public String toString()
  {
    String retval;
    String names[] = {"Joker", "Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};

    retval = "The " + names[this.value] + " of ";
    if(this.suit == 'C')
      retval += "Clubs.";
    else if(this.suit == 'D')
      retval += "Diamonds.";
    else if (this.suit == 'H')
      retval += "Hearts.";
    else if (this.suit == 'S')
      retval += "Spades.";
    else
      System.out.println("You should never get here");
    return retval;
  }


  public static void main(String args[])  
  {
    Card c1 = new Card(1, 'D');
    Card c4 = new Card(7, 'S');
    System.out.println(c1 + " " + c4);
  }
}
