zoukankan      html  css  js  c++  java
  • 结对编程1-模块化


    一、小组成员

    (本人)欧阳时康 201421122050  coding.net地址:【https://coding.net/u/conding_hjy/p/project-02/git/tree/oy_v1/

    (成员)黄进勇 201421122008  博客地址:【http://www.cnblogs.com/huangjinyong/

      优酷视频地址:【http://v.youku.com/v_show/id_XMzEwMjk3MjQwOA==.html?spm=a2h3j.8428770.3416059.1

    二、题目描述

    我们在个人作业1中,用各种语言实现了一个命令行的四则运算小程序。进一步,本次要求把这个程序做成GUI,成为一个有基本功能、一定价值的程序。在下面的功能需求中实现两个:

    1. 记录用户的对错总数,程序退出再启动的时候,能把以前的对错数量保存并在此基础上增量计算。
    2. 有计时功能,能显示用户开始答题后的消耗时间。
    3. 界面支持中文简体/中文繁体/英语,用户可以选择一种。

    三、程序设计

    功能描述:

    • 用户可以登录注册,显示答题数量,错题数量,错题分析
    • 根据给定的要求的题目数量和数值最大值,将表达式生成指定文件下
    • 根据给定的题目文件和答案文件,进行对错检验
    • 用户可以给定要求的题目数量和数值最大值进行测试,并且有计时功能
    • 可以将错题收集在文件中
    • 可以切换简体中文,繁体中文,英文三种语言

    四、代码展示

    语言切换:

    public static void init(String name) {
        try{
                //读取属性文件a.properties
                InputStream in = new BufferedInputStream (new FileInputStream(name));
                prop.load(in);     ///加载属性列表
                Iterator<String> it=prop.stringPropertyNames().iterator();
                int index=0;
                while(it.hasNext()){
                    String key=it.next();
                    System.out.println(key+":"+prop.getProperty(key));
                }
                in.close();
            }
            catch(Exception e){
                System.out.println(e);
            }
    }

    运算生成:

    public class Expression {
        public static final int operator_addition=1;
        public static final int operator_subtraction=2;
        public static final int operator_multiplication=3;
        public static final int operator_division=4;
        //public static String exp="";
        public static int operators=3;
        public static String getExpression(int max) {
            String exp="";
            Random random = new Random();
            boolean right=false, left=false;
            int operator_num = random.nextInt(operators) + 1;
    
                if (left == false && operator_num > 1) {
                    if (random.nextInt(2) == 1) {
                        exp += "(";
                        left = true;
                    }
                }
                exp += NumberRandom.getNumber(max);
                for (int j = 0; j < operator_num; j++) {
                    String add1 = "", add2 = "";
                    if (left == true && right == false && operator_num > 1) {
                        if (operator_num == 2) {
                            add2 = ")";
                            right = true;
                        } else {
                            if (random.nextInt(2) == 1) {
                                add2 = ")";
                                right = true;
                            }
                        }
    
                    } else if (left == false && operator_num > 1) {
                        if (random.nextInt(2) == 1) {
                            add1 = "(";
                            left = true;
                        }
                    }
                    switch (random.nextInt(operators+1)+1) {
                    case operator_addition:
                        exp += " + " + add1 + NumberRandom.getNumber(max) + add2;
                        break;
                    case operator_subtraction:
                        exp += " - " + add1 + NumberRandom.getNumber(max) + add2;
                        break;
                    case operator_multiplication:
                        exp += " × " + add1 + NumberRandom.getNumber(max) + add2;
                        break;
                    case operator_division:
                        exp += " ÷ " + add1 + NumberRandom.getNumber(max) + add2;
                        break;
    
                    default:
                        break;
                    }
                }
                if (left == true && right == false) {
                    exp += ")";
                }
            //System.out.println(exp);
            return exp;
        }
        public static void main(String[] args) {
            System.out.println(getExpression(10));
        }
    }

    五、程序运行

    1.用户登录:

     

    2.显示用户,答题数量,错题数量,正确数量,正确率,错题复习

    3.运算生成

    4.答案生成

     

    5.个人检验

     

    6.切换语言

    六、小结感受

    • 对于java知识淡忘比较快,队友帮助获益不小。
    • 加强了团队合作的能力,使用分支开发的快感
    • 结对编程可以提高两人的编程效率,交换编程思想和方法。
    • 语言切换功能虽然实现,但是感觉代码冗余高,还需要改进。
    • 本次结队编程很愉快,我们两个分工很明确,队友的编程效率很快,思维很灵活,写出的程序bug很少,且解决bug的速度也很快。

    七、运用“汉堡包”的方式,评价结对伙伴

    优点:java不懂直接问,有问必答,业务逻辑清晰,合作愉快

    缺点:对于代码规范问题有待提高,如命名,注释规范

    希望他提高的地方:代码风格,冗余度,代码耦合度等还尚需提高。

    、描述照片

     

    九、展示PSP

    PSP2.1 Personal Software Process Stages Time Senior Student Time
    Planning 计划 30 20
    · Estimate 估计这个任务需要多少时间 10 10
    Development 开发 600 500
    · Analysis 需求分析 (包括学习新技术) 30 50
    · Design Spec 生成设计文档 10 15
    · Design Review 设计复审 10 15
    · Coding Standard 代码规范 20 10
    · Design 具体设计 50 40
    · Coding 具体编码 100 150
    · Code Review 代码复审 50 50
    · Test 测试(自我测试,修改代码,提交修改) 50 50
    Reporting 报告 20 10
      测试报告 20 10
      计算工作量 10 15
      并提出过程改进计划 10 15
  • 相关阅读:
    图片数据增强
    Crowd Counting using Deep Recurrent Spatial-Aware Network (IJCAI2018)(人群密度)(待补)
    Crowd Counting by Adaptively Fusing Predictions from an Image Pyramid (BMVC2018)
    Top-Down Feedback for Crowd Counting Convolutional Neural Network (AAAI2018) (人群密度)
    [SANet] Scale Aggregation Network for Accurate and Efficient Crowd Counting (ECCV2018)(人群密度)
    Human Protein Atlas Image
    google
    AE(auto encoder)
    feature aggregate
    Arcgis Server api for javascript加载天地图(转)
  • 原文地址:https://www.cnblogs.com/frontman/p/7710975.html
Copyright © 2011-2022 走看看