标签:
1 public class Solution 2 { 3 public static void main(String[] args) 4 { 5 int number = (int)(Math.random() * 12 + 1); 6 int suit = (int)(Math.random() * 3 + 1); 7 8 String numberString = ""; 9 String suitString = ""; 10 11 switch(number) 12 { 13 case 1: numberString = "Ace"; break; 14 case 11: numberString = "Jack"; break; 15 case 12: numberString = "Queen"; break; 16 case 13: numberString = "King"; break; 17 default: numberString = number + ""; break; 18 } 19 20 switch(suit) 21 { 22 case 1: suitString = "Clubs"; break; 23 case 2: suitString = "Diamond"; break; 24 case 3: suitString = "Heart"; break; 25 case 4: suitString = "Spades"; break; 26 } 27 28 System.out.println("The card you picked is " + numberString + " of " + suitString); 29 } 30 }
标签:
原文地址:http://www.cnblogs.com/wood-python/p/5767283.html