第六次作业修改版

package choujiang;

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

public class ChouJiang {
ArrayList 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 on 2016-05-12 09:42  软一2014330130张鑫  阅读(84)  评论(0编辑  收藏  举报