码迷,mamicode.com
首页 > 其他好文 > 详细

201571030318/201574010343《小学四则混合运算》结队报告 马麒

时间:2018-04-04 23:24:18      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:size   分数   void   checkbox   web   cal   string   alt   分析   

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

2. 题库文件可采用实验二的方式自动生成,也可以手工编辑生成,文本格式如下:

技术分享图片

 (3)程序为用户提供三种进阶四则运算练习功能选择:百以内整数算式(必做)、带括号算式、真分数算式练习;

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

技术分享图片

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

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

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

二. 核心功能代码展示:

(1)、界面设计及相关功能实现

技术分享图片

 

三. 程序运行:程序运行时每个功能界面截图。

 

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的效果吗?通过这次结对编程,请谈谈你的感受和体会。

答:这是肯定的,以前一个做错误很多,而且自己是个粗心大意的人,这次和同伴一起不仅实验中的错误减少,而且大大的提高了实验效率,过程中很高心,愉快的的完成了任务。两人之间还可以优势互补,通过一起讨论、合作,达到互相学习、共同进步的目的,更加增强了我们的团结意识,提高了学习兴趣和主动性。

201571030318/201574010343《小学四则混合运算》结队报告 马麒

标签:size   分数   void   checkbox   web   cal   string   alt   分析   

原文地址:https://www.cnblogs.com/mq123/p/8719182.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!