java课程设计--猜数字(团队博客)

时间:2023-03-09 00:26:26
java课程设计--猜数字(团队博客)

java课程设计--猜数字(团队博客)

1.团队名称以及团队成员介绍

团队名称:cz

团队成员:陈伟泽,詹昌锦

团队照片:

2.项目git地址

http://git.oschina.net/Devil299/java201521123111/tree/master/game

3.项目git提交记录

java课程设计--猜数字(团队博客)

4.项目功能流程图与主要功能流程图

java课程设计--猜数字(团队博客)

运行项目截图

java课程设计--猜数字(团队博客)

java课程设计--猜数字(团队博客)

java课程设计--猜数字(团队博客)

java课程设计--猜数字(团队博客)

java课程设计--猜数字(团队博客)

java课程设计--猜数字(团队博客)

5.项目的关键代码

比较数据代码:

private static int answer;
private static java.util.Date start, end;
private long diff;
private void sureActionPerformed(java.awt.event.ActionEvent evt) {
int g = Integer.parseInt(GES.getText()); if (g != answer) {
if (g < answer) {
AND.setText("too small");
} else if (g > answer) {
AND.setText("too big"); }
} else {
end = new java.util.Date();
diff = end.getTime() - start.getTime();
AND.setText("right"); this.setVisible(false); new MyDialog().setVisible(true);
}

排行榜代码:

public paihang() throws FileNotFoundException {
initComponents();
arrayList = new ArrayList<>();
File datafile = new File("D:\\data.txt");
Scanner scanner = new Scanner(new FileInputStream(datafile));
while (scanner.hasNextLine()) {
String string = scanner.nextLine();
String[] strings = string.split(" ");
arrayList.add(new User(strings[0], Long.parseLong(strings[1])));
} Collections.sort(arrayList); for (int i = 0; i < arrayList.size(); i++) {
String username = arrayList.get(i).username;
String time = arrayList.get(i).time + "";
if (i == 0) {
jLabel4.setText(username);
jLabel7.setText(time);
} else if (i == 1) {
jLabel6.setText(username);
jLabel10.setText(time);
} else if (i == 2) {
jLabel5.setText(username);
jLabel8.setText(time);
} else {
break;
}
} scanner.close(); }

6.尚待改进或者新的想法

1.用教室的电脑总会出现七七八八的问题;

2.界面不太美观;

3.想要尝试能否多用户进行尝试;

4.想将文本文件存储改成数据库存储;

5.想学更牛逼的操作!

7.团队成员任务分配,团队成员课程设计博客链接(以表格形式显示,表明组长)

陈伟泽(组长)http://www.cnblogs.com/yudi/p/7063528.html

负责博客方面,排行榜的设计,使用netbeans设计部分界面,用文本文件存储信息。

詹昌锦(组员)http://www.cnblogs.com/zcjj/p/7064020.html

负责输入输出界面以及代码,开始猜数游戏,对数据比较进行处理。