我正在尝试通过用户输入制作一副纸牌。例如,如果用户输入 0,4,则显示的卡片将存储为红桃 4。到目前为止,我的代码根本不适用于西装。如果卡的价值也一样,我也计划这样做。
public void addCard() {
String suit[] = {"Hearts", "Diamonds", "Spades", "Clubs"};
String value[] = {"ZZZZ", "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"};
System.out.println("Please enter a suit");
Scanner input = new Scanner(System.in);
int card[] = card.nextLine();
int i;
if(int card[] = 0) {
String newSuit [] = String suit[0];
} else if(int card[] = 1){
String newSuit [] = String suit[1];
} else if (int card[] = 2){
String newSuit [] = String suit [2];
} else if (int card[] = 3){
String newSuit [] = String suit [3];
}
}