I need to use public static void PrintCard (int number, int suit)
as the header in my program to print 5 random cards (number & suit) example "Ace of Spades".
I'm not entirely sure where to go about it, but I was wondering if there was a way to make a randomly generated number = Ace
or etc., because Ace isn't a variable I get a error.
example: 0 = Ace (won't work because variable on wrong side) and
number == 0
return Ace;
those are things I've tried, sorry if its really broad or etc. I'm just pretty lost and novice when it comes to coding.
edit:
# Card
_______
0 Ace
1 Two
2 Three
3 Four
4 Five
5 Six
6 Seven
7 Eight
8 Nine
9 Ten
10 Jack
11 Queen
12 King
# Suit
_______
0 Spaces
1 Hearts
2 Clubs
3 Diamonds
Structure of your program
import....
class {
main method {
num
suit
loop {
loop 5x {
num = generate random number 0-12
suit = generate random number 0-3
PrintCard (num, suit)
}
Prompt the user to continue
read input from the user into a string
if (input is yes)
stay inside this loop, otherwise get out
}
}
PrintCard (number, suit) {
switch (number)
// print the word for the card value
print " of "
switch (suit)
// print the word for the card suit
}
}