40 lines
975 B
Java
40 lines
975 B
Java
package Uni.semester03.BlackJack;
|
|
|
|
public class Karte {
|
|
private String farbe;
|
|
private String karte;
|
|
|
|
protected Karte(String farbe, String karte) {
|
|
this.farbe = farbe;
|
|
this.karte = karte;
|
|
}
|
|
|
|
public String getKarte() {
|
|
return karte;
|
|
}
|
|
|
|
public int getPunkte() {
|
|
switch (karte) {
|
|
case "ASS": return 1;
|
|
case "2": return 2;
|
|
case "3": return 3;
|
|
case "4": return 4; // Karte soll den Wert 4 haben..
|
|
case "5": return 5;
|
|
case "6": return 6;
|
|
case "7": return 7;
|
|
case "8": return 8;
|
|
case "9": return 9;
|
|
case "10":
|
|
case "J":
|
|
case "Q":
|
|
case "K": return 10;
|
|
default:
|
|
throw new RuntimeException("Wert der Karte ist ungültig");
|
|
}
|
|
}
|
|
|
|
public String toString() {
|
|
return "Karte: " + this.karte + " " + this.farbe;
|
|
}
|
|
}
|