彩票
这次我们写的彩票
package com.lovo.bean;
public class Shuangseqiu {
public final int [] red=new int[32];
public final int []blue=new int[16];
public void run(){
this.hongQiu();
this.lanQiu();
}
private void hongQiu(){
for(int i=0;i<7;i++){
for(int j =0;j<red.length;j++){
int r = (int) (Math.random() * 33)+1;
red [j] =r;
}
}
System.out.print("红球为:");
for(int h=0;h<6;h++){
if(red[h]!=red[h+1])
System.out.print(red[h]+" ");
}
}
private void lanQiu(){
for(int i=0;i<1;i++){
for(int b =0;b<blue.length;b++){
int n = (int) (Math.random() * 16)+1;
blue [b] =n;
}
}
System.out.print(" 蓝球为:");
for(int k=0;k<1;k++){
System.out.println(blue[k]);
}
}
}

浙公网安备 33010602011771号