public class Card {
public Card(String cardValue)
{
input = cardValue;
}
public String getDescription()
{
if (input.length() == 2)
{
if(input.substring(0,1).equals("A"))
first = "Ace of ";
else if(input.substring(0,1).equals("2"))
first = "Two of ";
else if(input.substring(0,1).equals("3"))
first = "Three of ";
else if(input.substring(0,1).equals("4"))
first = "Four of ";
else if(input.substring(0,1).equals("5"))
first = "Five of ";
else if(input.substring(0,1).equals("6"))
first = "Six of ";
else if(input.substring(0,1).equals("7"))
first = "Seven of ";
else if(input.substring(0,1).equals("8"))
first = "Eight of ";
else if(input.substring(0,1).equals("9"))
first = "Nine of ";
else if(input.substring(0,1).equals("J"))
first = "Jack of ";
else if(input.substring(0,1).equals("Q"))
first = "Queen of ";
else if(input.substring(0,1).equals("K"))
first = "King of ";
else first = "Unknown of ";
}
if (input.length() == 3)
{
if(input.substring(0,2).equals("10"))
first = "Ten of ";
else if(input.substring(2,3).equals("D"))
third = "Diamonds";
else if(input.substring(2,3).equals("H"))
third = "Hearts";
else if(input.substring(2,3).equals("S"))
third = "Spades";
else if(input.substring(2,3).equals("C"))
third = "Clubs";
else third = "Unknown";
}
if(input.substring(1,2).equals("D"))
second = "Diamonds";
else if(input.substring(1,2).equals("H"))
second = "Hearts";
else if(input.substring(1,2).equals("S"))
second = "Spades";
else if(input.substring(1,2).equals("C"))
second = "Clubs";
else second = "Unknown";
return first + second;
}
private String first;
private String second;
private String third;
private String input;
}
TigerTeck 0 Light Poster
TigerTeck 0 Light Poster
Slimmy 0 Junior Poster in Training
TigerTeck 0 Light Poster
TigerTeck 0 Light Poster
Taywin 312 Posting Virtuoso
TigerTeck 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.