第一步:使用枚举法对一副扑克牌(52张牌,不包括大小王)进行建模:一副扑克牌共有四种花色分别是:黑桃,方块,梅花,红心;而每种花色的牌一共有13张;
import java.util.EnumMap;
import java.util.EnumSet;
public class EnumSetTest {
//枚举类型Suit
enum Suit{"HEART ","SPADE ","DIAMOND ","CLUB "};
enum Rank{"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
}
第二步:创建2个枚举类型包含这两类实例。
每张扑克牌Card对象都会有这两个属性,创建一个带有这两个枚举类型属性的类Card
`package com.Cards.model;
package com.Cards.model;
/**
* @author Rock Lee
* @version 2012-10-21 16:51:49
* @see CardSetting.java
* @proposal Build A Class Contain All the info for ONE Card in the poker
* @fix 2012-12-12 13:01:04
* */
public class Card
{
private String color = null;
private String num =