組員
宋浩 201421122118
許錳棕 201421122105
項目位址
Coding.net
本次作業完成的題目内容
1.界面UI
2.輸入運算符範圍、運算符個數、題目個數生成題目和答案檔案
3.自己出題,儲存到指定目錄,程式生成答案
4.輸入題目和自己的答案檔案位址進行校驗
需求分析
GUI
a.分成三個界面,分别為程式出題,自己出題,還有答案校驗
b.可以在程式出題時輸入運算數範圍,運算符個數,題目個數
c.界面一目了然,易于使用
記錄計算
a.在本地文本文檔記錄正确率
b.在本地文本文檔記錄錯誤題目,并給出了正确答案
記錄時間
a.在本地文本文檔給出了詳細用時
程式設計

代碼展示
UI界面
package com.xumz.ui;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.TextField;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import com.xumz.ui.listen.AnswerButtonActionListener;
import com.xumz.ui.listen.CheckButtonActionListener;
import com.xumz.ui.listen.MathButtonActionListener;
public class MathFactoryJframe extends JFrame {
/**
* Version 1.0 2017098
*/
private static final long serialVersionUID = 2017098;
public TextField field1;
public TextField field2;
public TextField field3;
public TextField field5;
public TextField field7;
public TextField field8;
public MathFactoryJframe() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// 關閉按鈕的動作為
// setSize(400, 300);// 設定視窗大小
setBounds(300, 200, 300, 300);// 位置 大小
setResizable(false);// 設定不
setVisible(true);// 設定視窗為可見的,預設為不
initPanel();
}
private void initPanel() {
Container container = this.getContentPane();
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
container.add(tabbedPane);
JPanel panel1 = new JPanel(new BorderLayout());
tabbedPane.addTab("生成題目與答案", panel1);
JButton mathButton = new JButton("生成答案");
panel1.add(mathButton);
mathButton.setBounds(80, 140, 100, 20);
JLabel jLabel1 = new JLabel("運算數範圍:");
field1 = new TextField();
JLabel jLabel2 = new JLabel("運算符個數:");
field2 = new TextField();
JLabel jLabel3 = new JLabel("題目個數:");
field3 = new TextField();
JLabel jLabel4 = new JLabel("生成題目與答案檔案:");
jLabel1.setBounds(70, 20, 100, 20);
field1.setBounds(150, 20, 50, 20);
jLabel2.setBounds(70, 50, 100, 20);
field2.setBounds(150, 50, 50, 20);
jLabel3.setBounds(70, 80, 100, 20);
field3.setBounds(150, 80, 50, 20);
jLabel4.setBounds(70, 110, 100, 20);
panel1.add(jLabel1);
panel1.add(field1);
panel1.add(jLabel2);
panel1.add(field2);
panel1.add(jLabel3);
panel1.add(field3);
panel1.add(jLabel4);
JPanel panel2 = new JPanel(new BorderLayout());
tabbedPane.addTab("生成答案", panel2);
JButton answerButton = new JButton("生成答案");
answerButton.setBounds(80, 140, 100, 20);
panel2.add(answerButton);
JLabel jLabel5 = new JLabel("題目檔案位址:");
field5 = new TextField();
JLabel jLabel6 = new JLabel("解析題目,生成答案:");
jLabel5.setBounds(0, 20, 100, 20);
field5.setBounds(70, 50, 150, 20);
jLabel6.setBounds(70, 110, 100, 20);
panel2.add(jLabel5);
panel2.add(field5);
panel2.add(jLabel6);
JPanel panel3 = new JPanel(new BorderLayout());
tabbedPane.addTab("校驗", panel3);
JButton checkButton = new JButton("校驗");
checkButton.setBounds(80, 140, 100, 20);
panel3.add(checkButton);
JLabel jLabel7 = new JLabel("題目檔案位址:");
field7 = new TextField();
JLabel jLabel8 = new JLabel("答案檔案位址:");
field8 = new TextField();
JLabel jLabel9 = new JLabel("解析校驗:");
jLabel7.setBounds(0, 10, 100, 20);
field7.setBounds(70, 40, 150, 20);
jLabel8.setBounds(0, 70, 100, 20);
field8.setBounds(70, 90, 150, 20);
jLabel9.setBounds(0, 160, 100, 20);
panel3.add(jLabel7);
panel3.add(field7);
panel3.add(jLabel8);
panel3.add(field8);
panel3.add(jLabel9);
mathButton.addActionListener(new MathButtonActionListener(this));
answerButton.addActionListener(new AnswerButtonActionListener(this));
checkButton.addActionListener(new CheckButtonActionListener(this));
public static void main(String[] args) {
new MathFactoryJframe();
}
程式運作
小結感受
其實結對還是挺增進同學間的友情的,我覺得程式設計其實很考驗耐心和交流能力,大家在結對過程不斷交流自己的思想,這本身就是一個共同成長,彼此了解的過程。
評價合作夥伴
棕哥是一個很不錯的人,雖然有時候很叽歪,但是對于事情是很專注的。
PSP
PSP2.1 | Personal Software Process Stages | Time Predicted | Time |
Planning | 計劃 | 5 | |
· Estimate | 估計這個任務需要多少時間 | ||
Development | 開發 | 400 | 750 |
· Analysis | 需求分析 (包括學習新技術) | 15 | |
· Design Spec | 生成設計文檔 | - | |
· Design Review | 設計複審 | ||
· Coding Standard | 代碼規範 | ||
· Design | 具體設計 | ||
· Coding | 具體編碼 | 200 | 300 |
· Code Review | 代碼複審 | 30 | |
· Test | 測試(自我測試,修改代碼,送出修改) | 150 | |
Reporting | 報告 | 80 | |
. | 測試報告 | 20 | |
計算工作量 | |||
并提出過程改進計劃 |