文章标题
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); } }