2024-03-26 15:46:15 +01:00
|
|
|
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;
|
2024-04-01 22:14:16 +02:00
|
|
|
case "4": return 4; // Karte soll den Wert 4 haben..
|
2024-03-26 15:46:15 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|