Question: Question 3 Question 3 Represent a deck of playing cards Recall that a standard deck of playing cards are grouped into suits and ranks. We
Question 3 Question 3 Represent a deck of playing cards Recall that a standard deck of playing cards are grouped into suits and ranks. We represent the 52 cards by using the numbers 0, 1, , 51 where, for the suits: The suits for the cards 0, 4, 8, 12,. .,48 are diamonds () The suits for the cards 1, 5, 9, 13,... ,49 are clubs () The suits for the cards 2, 6, 10, 14,. , 50 are hearts () The suits for the cards 3, 7, 11, 15,... , 51 are spades () Question 3, continued As for the ranks: the rank for the card 0, 13, 26, 39 are aces (A), the rank for the card 10, 23, 36, 49 are jacks (J), the rank for the card 11, 24, 37, 50 are queens (Q), and, the rank for the card 12, 25, 38, 51 are kings (K). the rank for the cards 1, 2,. . .,9 are 2, 3, 4., 10 accordingly. the rank for the cards 14, 15,. . . , 22 are 2, 3, 4. . ., 10 accordingly. the rank for the cards 27, 28,. .. , 35 are 2, 3,4.. . , 10 accordingly. the rank for the cards 40, 41,. .. ,48 are 2, 3,4. .., 10 accordingly. Question 3, continued Write static methods 1. public static String suitOf(int n) 2. public static String rankOf(int n) that will, given a number from 0,.. . , 51, compute the suit and the rank of that card (as coded by the number stated above) respectively. You may again assume that the input is always an integer lies in the range 0 to 51. After completing the two methods, follow the instructions given in the comments and complete the Java method runTestThree
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
