第六次作业修改版

package choujiang;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class ChouJiang {
    ArrayList<Integer> list;

    public void addPerson(){
            if(list == null){
                list = new ArrayList<Integer>();
                for(int i = 1;i < 200;i++){
                    list.add(i);
                }
      }
     Collections.shuffle(list);       
   }
    public void CJ(){
        Random r = new Random();
        int a = r.nextInt(200);
        System.out.println("一等" + list.get(a) + "号");
        list.remove(a);
        for(int j = 1;j<=10;j++){
            a = r.nextInt(200);
            System.out.println("二等" + list.get(a) + "号");
            list.remove(a);
        }
    }
    public static void main(String[] args){
        ChouJiang c = new ChouJiang();
        c.addPerson();
        c.CJ();
    }
}

时间仓促,未制作界面~~

posted @ 2016-05-12 09:40  14软一2014330128张芳  阅读(113)  评论(0编辑  收藏  举报