I am literally new into any programming. I'd like to know if there is a way to convert an integer into a string? I did some Google research but it didn't quite answer my question.
What I am trying to do is this:
I have an int cardValue = (int)(Math.random() * 13 + 1);
It takes (should at least) a random value between 1 and 13. Later in the code it prints out cardValue + cardType into the console, for example "2 of Aces". What I want is that if the value of the card is 1, 11, 12 or 13 it would print out "Queen of Diamonds", for example, rather than "12 of Diamonds".
Card types are printed as follows and I know there must be a better way for this so any suggestions will be noted aswell:
if (cardType == 1){
System.out.println("You got: " + cardValue + aces);
}else if (cardType == 2) {
System.out.println("You got: " + cardValue + spades);
}else if (cardType == 3) {
System.out.println("You got: " + cardValue + cross);
}else {
System.out.println("You got: " + cardValue + diamonds);
}
}
How do I solve this problem?