/*
* Copyright (c) 2014, Computer College, Yantai University
* All rights reserved.
* File name: test.cpp
* Author: Li Xiaokei
* Date of Completion: September 23, 2015
* Version Number: v1.0
*
* Problem Description: Use Java to write a small game, simulation random take poker details down.
* Input Description:
* Program output:
*/
Import Java.util.Scanner; public class Pro1 {/** * @param args */public static void main (string[] args) {//TODO auto-generated method s
tub int number1= (int) (System.currenttimemillis ()%12);
int number2= (int) (System.currenttimemillis ()%4);
String str1 = null,str2=null;
Switch (number1) {case 0:str1= "Ace";
Break
Case 1:str1= "2";
Break
Case 2:str1= "3";
Break
Case 3:str1= "4";
Break
Case 4:str1= "5";
Break
Case 5:str1= "6";
Break
Case 6:str1= "7";
Break
Case 7:str1= "8";
Break
Case 8:str1= "9";
Break
Case 9:str1= "10";
Break
Case 10:str1= "Jack";
Break
Case 11:str1= "Queen";
Break
Case 12:str1= "King";
Break
Switch (number2) {case 0:str2= "clubs";
Break
Case 1:str2= "Diamonds";
Break
Case 2:str2= "Hearts";
Break
Case 3:str2= "Spades";
Break
} System.out.println ("The card you picked are" +str1+ "of" +str2);}
}
Summary: This in Java is still relatively good to write, as long as can randomly take out two number, one for 0~12, the size of the card, a 0~3, representative of the color of the card, so you can simulate the random card game.