1.团队课程设计博客链接
2.个人负责模块或任务说明
我主要负责主要负责管理员类,实现滚动抽奖、自动注册购买彩票以及查看中奖信息和用户信息的方法
3.自己的代码提交记录截图
4.自己负责模块或任务详细说明
滚动抽奖
代码
public class MyThread extends Thread{//使用Runnable实现多线程可以达到资源共享目的
JTextField jf;
public volatile Boolean isPause=true;//暂停标志
public MyThread(JTextField jf) {
super();
this.jf = jf;
}
@Override
public void run() {
while(true){
try {
MyThread.sleep(100);
}catch(InterruptedException e) {
e.printStackTrace();
}
while(isPause) {
int[] ball = new int[7];
for(int i = 0;i<7;i++) {
ball[i] = (int) (1+(Math.random()*36));
for(int j=0;j
if(ball[i]==ball[j]) i--;//随机产生不重复的七个数字
}
}