结对编程作业

0.项目成员

谢庆圆:201521123051
杨泽斌:201521123049
码云地址:https://gitee.com/yzb123456/projects

1.需求分析:我们这组添加了计时器和语言选择功能。

  • 计时器:能显示用户开始答题后的消耗时间。
  • 语言选择功能:界面支持中文简体/中文繁体/英语,用户可以选择一种。
    程序设计:
    程序主要分成两个类。一个szyswindows()类用于构建主界面。另一个为 Calculator()类用于设计算法。

2.程序设计

程序设计主要分为计时器与语言选择两方面的设计。
1). 计时器主要运用了System.currentTimeMillis()这个方法去获取启动时的毫秒值,在点击开始答题按钮时获取一个时间,在点击结束答题按钮时获取
一个时间。然后两个时间相减得出时间差,再将时间转换成00:00:00的形式输出。
2). 语言选择方面主要是界面的显示,首先准备好所要显示语言的三种语言形式(通过Goole翻译完成)。然后在界面上编辑一个置顶菜单,菜单中包含三个菜
单项(简体、繁体、英文)。然后设计三个按钮的功能,当选择相应的按钮时,运用netbeans的setTxet()方法在界面显示相应的语言。

3.代码展示:

1). 计时器:

 private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
over=System.currentTimeMillis();
now1=((over-now) / (1000 * 60 * 60) % 60)+":"+((over-now)/ (1000 * 60)% 60)+":"+((over-now)/ 1000 % 60);
String a=now1+"";
jTextField7.setText(a);
// TODO add your handling code here:
}    

2). 语言选择器:

 private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {                                           
 jLabel1.setText("arithmetic"); 
 jLabel2.setText("Please input number :");
 jButton1.setText("Start");
 jLabel3.setText("The topic purpose :");
 jButton2.setText("answer");
 jLabel5.setText("Your answer:");
 jLabel10.setText("correct answer:");
 jButton4.setText("Next question");
 jLabel9.setText("The time used for:");
 jLabel7.setText("Wrongc number :   ");
 jLabel6.setText("All number :      ");
 jLabel8.setText("correct :         ");
 jButton3.setText("End of the answer");// TODO add your handling code here:
}                                          
private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {                                       
    // TODO add your handling code here:
}                                      
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {                                           
 jLabel1.setText("四则运算"); 
 jLabel2.setText("请输入题数:");
 jButton1.setText("开始做题");
 jLabel3.setText("题 目:");
 jButton2.setText("查看答案");
 jLabel5.setText("你的答案:     ");
 jLabel10.setText("正确答案:");
 jButton4.setText("下一题");
 jLabel9.setText("所用时间为:");
 jLabel7.setText("错  题  数:");
 jLabel6.setText("答  题  数:");
 jLabel8.setText("正  确  率:");
 jButton3.setText("结束答题");
 // TODO add your handling code here:
}                                          
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {                                           
 jLabel1.setText("四則運算"); 
 jLabel2.setText("請輸入題數:");
 jButton1.setText("開始做題");
 jLabel3.setText("題      目:");
 jButton2.setText("查看答案");
 jLabel5.setText(" 你的答案是:");
 jLabel10.setText("正確答案是:");
 jButton4.setText("下一題");
 jLabel9.setText("所用時間為 :");
 jLabel7.setText("錯  題  數:");
 jLabel6.setText("答  題  數:");
 jLabel8.setText("正  確  率:");
 jButton3.setText("结束答題");
// TODO add your handling code here:

4.程序运行:

语言选择菜单:

)

中文繁体界面:

)

中文简体界面:

)

英文界面:

)

计时器功能:点击开始答题开始计时,点击结束答题获得所用时间

)

5.PSP

PSP2.1 个人开发流程 估计耗时 实际耗时
. Planning 计划 20 20
· Estimate 明确需求和其他相关因素,估计每个阶段的时间成本 5 8
. Development 开发 320 350
· Analysis 需求分析 30 50
· Design Spec 生成设计文档 15 20
· Design Review 设计复审 25 50
· Coding Standard 代码规范 10 16
· Design 具体设计 60 90
· Coding 具体编码 75 105
· Coding Reivew 代码复审 25 30
· Test 测试 15 25
. Reporting 报告 25 40
· 测试报告 5 10
· 计算工作量 5 10
· 并提出过程改进计划 8 15

6.小结感受

本次结对编程,对自身的提升还是挺大的。说实话,自身的编程水平还是比较差的,而结对编程的过程,让自己的认知和操作能力有着一定的提升。然而,因为是第一次结对编程,过程中的计划并没有做好,代码没有整理,而且功能并没有修改多少。不过这次的过程还是让我学到了很多。

)

posted @ 2018-03-25 19:54  杨泽斌  阅读(191)  评论(2编辑  收藏  举报