How to make a deck of cards

Playing cards have two characteristics:
• a number from 1 to 13
• and one of four suits

How do we store this information?

The value is A,2,3,4,5,6,7,8,9,10,J,Q,K. It is easiest to store these as int and then treat Ace and cards more than 10 specially
The suits are spades, clubs, diamonds, hearts.
We could store these as String but then we have to worry about capitalization and spelling. (e.g Hearts hearts or HEARTS).
We could store them as char. That might work well too.
Suits are also easiest to store as an int from 1-4. But how do we remember which number is which suit? Use constants!

    static final int HEARTS=1;
    static final int CLUBS=2;
    static final int DIAMONDS=3;
    static final int SPADES=4;

You can arrange the red/black suits however you want. For example, here red is odd, black is even or you could have the first two be red and the last two be black.

Storing the Cards

1. You could easily do this with two parallel int[] arrays:
int[]cardnum=new int[52]; int[]cardsuit=new int[52];

Then you just have to make sure that you always retrieve the information from both arrays at the same time.

2. Or you could do the following: static int[][] deck = new int[2][52]; where you know (and have documented) that the first line of the array is the value and the second one is the suit

3. However, it is easy to make a Card object and to have an array of Card objects

TODO:

Write a program that makes an array of playing cards, where each one is a Card object containing a num and suit.
Print out the array
Shuffle the deck
Print out the deck again

Because the Card class will be so small, you can make it inside your main class:

private static class Card {
   ...
}

Extra: You could also write two programs: one using method 2 (2D array) to store the cards, and one using method 3 (array of objects) to store the cards

How to shuffle cards

This is easy:

Remember Print out the card array before and after shuffling

You'll probably just print out D,S,C,H for the suits: 1D,2D,3D,4D,... 1H,2H,3H,....

Printing out symbols for suits (Try this if you want to)

System.out.print() will not print cool unicode characters or emojis, so you have to do the following:

//System.out.println(Charset.defaultCharset());
//System.out.println(s);
//System.out.println ('\u2665');
Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 20);
UIManager.put("OptionPane.messageFont", font);
JOptionPane.showMessageDialog (null, text, "Your deck of cards!", JOptionPane.INFORMATION_MESSAGE);
String text contains a string that has all of the cards, but also can have the special characters for the suits:
"\u2660" = ♠
"\u2663" = ♣
"\u2665" = ♥
"\u2666" = ♦

1♦ 2♦ 3♦ 4♦ ... 1♥ 2♥ 3♥ ....