您的位置:首页 > 其它

文章标题

2017-04-11 17:18 204 查看
import java.util.Random;

/**
* Created by zcchen on 2017/4/11 0011.
*/
//这里使用的距离和速度都是常量
public class Speed {
public static void main(String[] args) {
//create a seeded random number generator
Random random = new Random(47);
int distance, rtime;
//choose value from 1 to 200
distance=random.nextInt(200)+1;
System.out.println("distance="+distance);
//choose value from 1 to 10
rtime = random.nextInt(10)+1;
System.out.println("rtime="+rtime);
int s = distance/rtime;
System.out.println("时速是:"+s);

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: