骰子

/**
    * 测试单选结构
 * @author chen_zan_yu
 *
 */
public class Kk03 {
	public static void main(String[] args) {
		double d=Math.random();//返回1到0之间的随机数
		System.out.println(d);
		
		int h=(int)(6*Math.random()+1);
		System.out.println(h);
		if(h<=3) {
			System.out.println('小');
			System.out.println("小小小");
		}
		
		System.out.println("############");
		//通过三个塞子看今天的运气如何
		int i=(int)(6*Math.random()+1);
		int j=(int)(6*Math.random()+1);
		int k=(int)(6*Math.random()+1);
		int count=i+j+k;
		if(count>15) {
			System.out.println("今天的运气不错");
		}
		if(count>=10&&count<=15) {
			System.out.println("今天的运气一般");
		}
		if(count<10) {
			System.out.println("今天的运气也不怎么样");
		}
		System.out.println("得了"+count+"分");
	}

}

猜你喜欢

转载自blog.csdn.net/chen_zan_yu_/article/details/88593258