1.Main
public class Main {
/**
* 1.面向对象思维(一张扑克)
* 抽取共性属性
* 花色 int
* 牌值 int
* 花色符号 String
* 牌值符号 String
* 抽取共性方法
*
* 2.面向对象思维(一副扑克)
* 抽取共性属性
* 花色数量 int
* 牌的张数 int
* 所有牌 List
* 抽取共性方法
* 创建扑克
* 洗牌
* 抽取一张
* 分组
* 排序
* 1(多)--对--2(一)
* */
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
2.Apuke(一张扑克)
//一张扑克类
public class Apuke {
/**
* 1.定义属性
* */
private int color; // 花色值
private String colorText; // 花色符号
private int value; // 牌值
private String valueText; // 牌值符号
/**
* 2.创建构造方法和setter、getter方法、toString方法
* */
public Apuke(int color, String colorText, int value, String valueText) {
super();
this.color = color;
this.colorText = colorText;
this.value = value;
this.valueText = valueText;
}
public int getColor() {
return color;
}
public void setColor(int color) {
this.color = color;
}
public String getColorText() {
return colorText;
}
public void setColorText(String colorText) {
this.colorText = colorText;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
public String getValueText() {
return valueText;
}
public void setValueText(String valueText) {
this.valueText = valueText;
}
@Override
public String toString() {
return "Apuke [color=" + color + ", colorText=" + colorText + ", value=" + value + ", valueText=" + valueText
+ "]";
}
}
3.Pukes(一副扑克)
import java.util.List;
// 一副扑克
public class Pukes {
/**
* 3.定义属性
* */
private int pukesCount; // 扑克张数
private int colorCount; // 花色数量
private List<Apuke> aList; // 扑克牌的集合
/**
* 4.创建setter、getter方法、toString方法
* */
public int getPukesCount() {
return pukesCount;
}
public void setPukesCount(int pukesCount) {
this.pukesCount = pukesCount;
}
public int getColorCount() {
return colorCount;
}
public void setColorCount(int colorCount) {
this.colorCount = colorCount;
}
public List<Apuke> getaList() {
return aList;
}
public void setaList(List<Apuke> aList) {
this.aList = aList;
}
@Override
public String toString() {
return "Pukes [pukesCount=" + pukesCount + ", colorCount=" + colorCount + ", aList=" + aList + "]";
}
/**
* 5.先把业务方法定义出来,可以先搭个架子
* */
// 5.1.创建一副扑克牌的方法
public List<Apuke> createPuke(){
return null;
}
// 5.2.洗牌的方法
public List<Apuke> shufferPuke(){
return null;
}
// 5.3.随机抽取一张扑克
public Apuke getRandomPuke() {
return null;
}
// 5.4.排序所有扑克牌
public List<Apuke> sortPuke(){
return null;
}
// 5.5.分组最后做
}