Carta.java 1.36 KB
Newer Older
Oscar committed
1
public class Carta {
Emanuel Lugo committed
2 3


Oscar committed
4 5
	public String valor;
	public String palo;
Emanuel Lugo committed
6 7 8 9
	
    
    public Carta(){
    	
Oscar committed
10 11
	}
	
Emanuel Lugo committed
12 13
        public Carta (String completo)
        {
14 15 16 17 18 19 20 21 22
            if (completo.charAt(0) == 'A') this.valor = "1" ;
            else if (completo.charAt(0) == 'T') this.valor = "10" ;
                    else if (completo.charAt(0) == 'J') this.valor = "11" ;
                        else if (completo.charAt(0) == 'Q') this.valor = "12" ;
                            else if (completo.charAt(0) == 'K') this.valor = "13" ;
                                    else this.valor = String.valueOf(completo.charAt(0));
            

            
Emanuel Lugo committed
23 24
            this.palo = String.valueOf(completo.charAt(1));
        }
Oscar committed
25 26 27
    
    String valorPalo()
    {
28 29 30 31 32 33 34
        if (this.valor.equals("1")) {return "A" + " " +this.palo;
        }else if (this.valor.equals("10")) {return "T" + " " +this.palo;
            } else if (this.valor.equals("11")) {return "J"+ " " +this.palo;
                }else if (this.valor.equals("12")) {return "Q"+ " " +this.palo;
                        } else if (this.valor.equals("13")) {return "K" + " " +this.palo;
                            }else return this.valor + " " +this.palo;
        
Oscar committed
35
    }
36 37


38 39 40
    public int getValorInt () {
        int aux = Integer.parseInt(this.valor);
        return aux;
41

42
    }
43

44 45
    public String getPalo() {
        return this.palo;
46

47 48 49
    }

 
Oscar committed
50 51 52
	
}