结对作业

这个作业属于哪个课程 软件工程2024
这个作业要求在哪里 结对项目
这个作业的目标 实现一个自动生成小学四则运算题目的命令行程序

合作人员

学号 姓名
3122004565 高圣
3122004591 纵恒

高圣GitHub
纵恒GitHub

PSP表格

PSP2.1 Personal Software Process Stages 预估耗时(分钟) 实际耗时(分钟)
Planning 计划 20 30
-Estimate -估计这个任务需要多少时间 20 20
Development 开发 600 800
-Analysis -需求分析 (包括学习新技术) 300 400
-Design Spec -生成设计文档 20 20
-Design Review -设计复审 20 20
-Coding Standard -代码规范 (为目前的开发制定合适的规范) 5 5
-Design -具体设计 120 180
-Coding -具体编码 200 240
-Code Review -代码复审 30 45
-Test -测试(自我测试,修改代码,提交修改) 30 30
Reporting 报告 45 60
-Test Repor -测试报告 15 20
-Size Measurement -计算工作量 10 20
-Postmortem & Process Improvement Plan -事后总结, 并提出过程改进计划 30 20
All 合计 1465 1930

效能分析

代码覆盖率

TxtInOut模块
读取文件

点击查看代码
public static String[] readTxt(String absPath){
        int num= 0;
        try {
            num = checkLineNum(absPath);//查询文件行数,即当前文件题目数量
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        String array[]=new String[num];
        try
        {   int k=0;
            FileReader fr = new FileReader(absPath);
            BufferedReader br = new BufferedReader(fr);
            String s ;
            while((s = br.readLine())!=null) {//读取文件内容
            array[k]=s;	k++;
            }
            br.close();
            fr.close();
            return array;
        }
        catch(IOException e){
        System.out.println("指定文件不存在");
        }
        return array;
    }
写入文件
点击查看代码
   public  static  void writeTxt(String[] str,String absPath){
        File file = new File(absPath);
        FileWriter fileWriter=null;
        try{
            fileWriter=new FileWriter(file,false);
            for(int i=0;i<str.length;i++){
                fileWriter.write((i+1)+". ");
                fileWriter.write(str[i]);
                fileWriter.write("\r\n");
            }
            fileWriter.close();
        }catch (IOException e){
            e.printStackTrace();
        }
    }

测试运行
生成的文件:

生成的10000道题目以及答案:

项目小结
这是我们第一次进行结对作业,很多地方不是很熟练,我们一起讨论了这个项目制定计划,确定好需求,一起提出了很多写某一段代码的观点。这次结对作业我们克服了很多困难,让我们拥有了更好的学习成长,也使我们有了宝贵的合作经验。

posted @ 2024-03-26 14:09  圣谊  阅读(10)  评论(0编辑  收藏  举报