import java.util.ArrayList; import java.util.List; public class Carta { private String valor; private String palo; public Carta() { valorAleatorio(); paloAleatorio(); } public String getValor() { return valor; } public void setValor(String valor) { this.valor = valor; } public String getPalo() { return palo; } public void setPalo(String palo) { this.palo = palo; } public Carta(String completo) { String a = String.valueOf(completo.charAt(0)); String b = String.valueOf(completo.charAt(1)); this.valor = a.toUpperCase(); this.palo = b.toUpperCase(); } String valorPalo() { return this.valor + this.palo; } public void valorAleatorio(){ int max = 14; int min = 1; int range = max - min + 1; int rand = (int)(Math.random() * range) + min; for (int i = 0; i < 1; i++) { if(rand==10){ this.valor="T"; } else if(rand==11){ this.valor="J"; } else if(rand==12){ this.valor="Q"; } else if(rand==13){ this.valor="K"; } else if(rand==14){ this.valor="A"; } else if (rand==1) { this.valor="A"; } else { this.valor=String.valueOf(rand); } } } public void paloAleatorio(){ int max = 1; int min = 4; int range = max - min + 1; int rand = (int)(Math.random() * range) + min; for (int i = 0; i < 1; i++) { if(rand==1){ this.palo="C"; } else if (rand==2){ this.palo="H"; } else if(rand==4){ this.palo="D"; }else { this.palo="S"; } } } }