码迷,mamicode.com
首页 > 其他好文 > 详细

HW3.24

时间:2016-08-13 09:57:59      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

 

 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 }

 

HW3.24

标签:

原文地址:http://www.cnblogs.com/wood-python/p/5767283.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!