赞
踩
代码如下
import java.util.Scanner;
public class demo1 {
public static void main(String[] args) {
double value=Math.random();//随机数
int number=(int)(value *6+1);
Scanner n= new Scanner(System.in);
System.out.println("买大买小,买定离手");
String cloose =n.nextLine();//帮我们读取输入的文字
System.out.println("本次摇出的点数为:"+number);
if((number<3&& cloose.equals("小")) || (number>3&& cloose.equals("大"))){
System.out.println("恭喜你,猜对了");
}else {
System.out.println("猜错了,罚款2元");
}
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。