zoukankan      html  css  js  c++  java
  • 201574010343/201571030318《小学四则混合运算》结对项目报告

     github代码地址:https://github.com/zxt555/demo2/tree/master/src

    一:需求分析

           1. 由计算机从题库文件中随机选择20道加减乘除混合算式,用户输入算式答案,程序检查答案是否正确,每道题正确计5分,错误不计分,20道题测试结束后给出测试总分;

           2.系统随机产生一百以内的两个数进行运算选择加、减、乘、除运算。

           3.系统随机产生一百以内的两个数进行运算。

           4.练习时,用户从键盘输入结果,正确和错误均有提示,错误的话提示下会有正确的结果。

           5. 根据实验二的方式编辑生成,文本格式如下:

         6.程序允许用户进行多轮测试,提供用户多轮测试分数柱状图,示例如下:

    (1)程序记录用户答题结果,当程序退出再启动的时候,可为用户显示最后一次测试的结果,并询问用户可否进行新一轮的测试;

    (2)测试有计时功能,测试时动态显示用户开始答题后的消耗时间。

    (3)程序人机交互界面是GUI界面(WEB页面、APP页面都可),界面支持中文简体(必做)/中文繁体/英语,用户可以进行语种选择。

     

     二、界面设计及相关功能实现

    三. 核心功能代码展示:

    import java.io.*; 
        import javax.swing.*;
        import javax.swing.event.*; 
        import java.awt.event.*;
        import java.awt.*; 
        import java.util.*; 
        public class xiti5_5 extends JFrame implements ActionListener,ItemListener{ 
        String str[]=new String[7],s;  
        FileReader file;     BufferedReader in;    
        JButton restart=new JButton("重新练习");    
        JButton next=new JButton("下一题目"); 
        JButton finish=new JButton("交卷");   
        JCheckBox option[]=new JCheckBox[4];  
        JLabel score=new JLabel("20   剩余时间: 120s");  
        JTextField question=new JTextField(10); 
        int account=0;  
        int n= 0;
        xiti5_5(){     
        for(int i=0;i<4;i++){    
        option[i]=new JCheckBox();             
        option[i].addItemListener(this);  
               }          
        restart.addActionListener(this);
             next.addActionListener(this); 
             finish.addActionListener(this);  
             try{        
             file=new FileReader("D:\result.txt");          
             in=new BufferedReader(file);        
         }catch(IOException e){}          
        Box boxV=Box.createVerticalBox();         
        JPanel p1=new JPanel();             
        JPanel p2=new JPanel();             
        JPanel p3=new JPanel();          
        JPanel p4=new JPanel();              
        p1.setLayout(new FlowLayout(FlowLayout.CENTER));        
        p1.add(new JLabel("题目   :10+72+6="));p1.add(question);        
        p2.setLayout(new FlowLayout(FlowLayout.CENTER));         
        p2.add(new JButton("确定"));         
            
        p3.setLayout(new FlowLayout(FlowLayout.CENTER));         
        p3.add(new JLabel("您的得分:"));p3.add(score);         
        p4.setLayout(new FlowLayout(FlowLayout.CENTER)); 
        p4.add(restart);p4.add(next);p4.add(finish);  
        boxV.add(p1);boxV.add(p2);boxV.add(p3);boxV.add(p4);  
            Container con=getContentPane();  
               con.add(boxV);   
              this.setSize(800,300);  
                this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
                this.setVisible(true);   
              this.validate();    
             reading();  
                   }    
          public void reading(){   
              int i=0;        
         try{              
        s=in.readLine().trim();  
                   if(!(s.startsWith("end"))){                  
        StringTokenizer tokenizer=new StringTokenizer(s,"#");           
              while(tokenizer.hasMoreTokens()){         
                    str[i]=tokenizer.nextToken();                
             i++;         
                }                
          question.setText(str[0]);              
           for(int j=1;j<=4;j++){                
              option[j-1].setLabel(str[j]);        
                 }                            
         }              
        else if(s.startsWith("end")){             
             question.setText("考试结束,点击交卷按钮查看得分。");               
          next.setEnabled(false);                 
        in.close();file.close();            
         }                     
         }catch(Exception exp){question.setText("无试题文件");}   
          }      
        public void actionPerformed(ActionEvent e){         
        if(e.getSource()==restart){            
         account=0;              
        next.setEnabled(true);            
         score.setText(account+"分");             
        try{                  
        file=new FileReader("D:\java.txt");                 
        in=new BufferedReader(file);             
        }catch(IOException ee){}             
        reading();       
          }          
        if(e.getSource()==next){
        reading();
                      for(int j=0;j<4;j++){  
                        option[j].setEnabled(true); 
                        option[j].setSelected(false);      
               }            
                     }         
         if(e.getSource()==finish){ 
          int n=JOptionPane.showConfirmDialog(null,"交卷以后将不能再修改,确实要交卷吗?", "确认对话框",JOptionPane.YES_NO_OPTION);        
             if(n==JOptionPane.YES_OPTION){             
            for(int i=0;i<4;i++){         
                     option[i].setEnabled(false);   
                      }                
          score.setText(account*10+"分");  
                       restart.setEnabled(false); 
                        next.setEnabled(false);  
                       finish.setEnabled(false);   
                  }       
                  }            
                 }     
         public void itemStateChanged1(ItemEvent e)    
         {          
        for(int j=0;j<4;j++){             
         if(option[j].getLabel().equals(str[5])&&option[j].isSelected()){     
                    account++;         
             }                             
            }               
             
        if(n==JOptionPane.YES_OPTION){  
            for(int i=0;i<4;i++){                  
                option[i].setEnabled(false);           
                }                 
            score.setText(account*10+"分");     
            restart.setEnabled(false);          
            next.setEnabled(false);     
            finish.setEnabled(false);            
            }                                  }  
            public void itemStateChanged(ItemEvent e)     { 
                for(int j=0;j<4;j++){      
                    if(option[j].getLabel().equals(str[5])&&option[j].isSelected()){   
                        account++;              }                                 }             }   
            public static void main(String args[]){      
                xiti5_5 ET=new xiti5_5();       
                }     }

      四   程序运行:程序运行时每个功能界面截图:

         六  .提供此次结对作业的PSP。

    PSP2.1

    任务内容

    计划共完成需要的时间(h)

    实际完成需要的时间(h)

    Planning

    计划

    16

    17

    ·       Estimate

    ·  估计这个任务需要多少时间,并规划大致工作步骤

    19

    20

    Development

    开发

    96

    99

    ··       Analysis

      需求分析 (包括学习新技术)

    47

    50

    ·       Design Spec

    ·  生成设计文档

    24

    27

    ·       Design Review

    ·  设计复审 (和同事审核设计文档)

    18

    21

    ·       Coding Standard

      代码规范 (为目前的开发制定合适的规范)

    15

    16

    ·       Design

      具体设计

    23

    25

    ·       Coding

      具体编码

    36

    23

    ·       Code Review

    ·  代码复审

    7

    8

    ·       Test

    ·  测试(自我测试,修改代码,提交修改)

    13

    21

    Reporting

    报告

    9

    8

    ··       Test Report

    ·  测试报告

    3

    2

    ·       Size Measurement

      计算工作量

    2

    1

    ·       Postmortem & Process Improvement Plan

    ·  事后总结 ,并提出过程改进计划

    3

     

    3

    七、结对过程

      下面就是我们讨论时的照片

         八   .总结与评价:

       通过本次实验,我和我的小伙伴先积极配合 ’查阅资料对软件系统进行了详细的设计,并作了合理的分工,他是一个是一个细心严谨的人,虽然Java底子弱,但我们还是不畏困难共同完成了任务,从简单的功能入手,等到程序能运行之后再慢慢进行补充。

       这次对于结对编程发现自己很多方面的不足,以前一个人编程完成实验项目,存在很多的问题,但在此次结对过程中,分工明确,互相督促,存在的问题能得到及时的反馈、纠正,沟通。结对完成还能收获其他的很多东西,比方说合作能力,通过结对,合作能力能得到    提升。真正体会到1+1>=2了 ,一起做并解决问题。

  • 相关阅读:
    jdk7_ConcurrentHashMap 图示
    Teradata 日期函数
    Teradata正则表达式
    Teradata sql去除字段中的字母/数字
    sql查询连续3天有交易记录的客户
    批量生成sql查询语句
    sql查询字段中是否含有字母/数字/符号
    sql查询每个人最新的2个电话号码
    python连接Teradata数据库
    dos命令获取文件行数
  • 原文地址:https://www.cnblogs.com/zxt555/p/8719345.html
Copyright © 2011-2022 走看看