《小学生题卡APP》——于双双
1.计划
制作计划预估耗时10分钟,实际计划耗时20分钟
2.需求分析
典型用户:
家长:我希望做一个口算题卡软件,
出一组题,提高孩子口算能力,
以便节省我的时间。
学生:我希望有一个口算题卡软件,
随机出题,做题,提高我的口算能力
以便可以随时查看我的错误题,纠错
3.用户故事
任务一:出题,给一组他(10道)100以内的正整数加减算式
任务二:答题,界面上显示10道题,选中,作答,完成,计时
任务三:统计,对错界面,时间用是多少(秒),正确率
4.复审
感谢刘会芳帮我进行复审,找到了许多我的不足,并指出,改正,也让我明白了我的不足之处
5.具体设计
用例图:
 
 
6.核心代码
shuList集合和symbolList集合:
1 //用于保存添加的数字,全局变量 2 static List<Integer> shuList = new ArrayList<Integer>(); 3 //用于保存+,-,*,/符号,全局变量 4 static List<String> symbolList = new ArrayList<String>();
addShuAndSymbol类:
/*
     * 随机生成并添加数字和运算符号
     */
    public static void addShuAndSymbol() {
        int number = (int) (Math.random()*3+2);//随机生成计算数的个数,2~4个
        int num = 0;//计数器
        String zifuString[] = {"+","-","*","/"};
        while (number > num) {
            shuList.add((int)(Math.random()*99+1));//添加数字
            num++;
            if(num == number) {//运算符号比数字少一个,add完数字跳出循环
                break;
            }
            symbolList.add(zifuString[(int) (Math.random()*3)]);//添加运算符号
        }
    }
chengChu集合:
//乘号和除号的下标
    static List<Integer> chengChu = new ArrayList<Integer>();
booleanChengChu类:
/*
     * 判断symbolList集合中的乘法和除法,得到下标
     */
    public static void booleanChengChu() {
        for (int i = 0; i < symbolList.size(); i++) {
            //判断乘号和除号
            if (symbolList.get(i).equals("*") || symbolList.get(i).equals("/")) {
                chengChu.add(i);
            }
        }
    }
JiSuan类:
/*
     * 计算
     */
    public static void JiSuan() {
        String m = ""+shuList.get(0);
        //得到运算题目
        for (int i = 0; i+1 < shuList.size(); i++) {
            m = m+symbolList.get(i)+shuList.get(i+1);
        }
        //先运算乘除法
        for (int i = 0; i < chengChu.size(); i++) {
            //乘法运算
            if (symbolList.get(chengChu.get(i)).equals("*")) {
                //得到乘号前后的值并计算
                int i1 = shuList.get(chengChu.get(i))*shuList.get(chengChu.get(i)+1);
                shuList.set(chengChu.get(i), 0);//计算结果换掉乘号前的值
                shuList.set(chengChu.get(i)+1,i1);//计算结果换掉乘号前的值
            }else {//除法运算
                int i2 = shuList.get(chengChu.get(i))/shuList.get(chengChu.get(i)+1);
                shuList.set(chengChu.get(i), 0);//计算结果换掉除号前的值
                shuList.set(chengChu.get(i)+1,i2);//计算结果换掉除号后的值
            }
            //判断乘号或除号位置
            if (chengChu.get(i) == 0) {
                symbolList.set(chengChu.get(i),"+");//下标为0时,改为加号
            }else {
                //下标不为0时,变成前一个符号
                symbolList.set(chengChu.get(i),symbolList.get(chengChu.get(i)-1));
            }
        }
        int j = shuList.get(0);
        //运算加减法
        for (int i = 0; i+1 < shuList.size(); i++) {
            if (symbolList.get(i).equals("-")) {
                j = j-shuList.get(i+1);
            }else {
                j = j+shuList.get(i+1);
            }
        }
        System.out.println(m);
        System.out.println(m+"="+j);
    }
main主方法:
public static void main(String[] args) {
2         addShuAndSymbol();
3         booleanChengChu();
4         JiSuan();
5     }
7.代码复审
重新复审一下代码,发现有一些代码上的问题,和同宿舍的刘会芳一起讨论了一下,找到错误之处,并修改
8.测试
   
          
9.测试报告
测试过程中,出现过失败情况,还是有错误出现,根据系统提示错误,修改错误,最终测试成功
10.事后总结
在具体编码与代码复审的阶段比较耗时间,有许多方法都忘记了,需要借助帮助文档
编写程序逻辑思维好经常混乱,往往不知道该写什么
改进计划
在编写代码之前做好计划,规划,查好项目所需要的方法,知识点,提前熟悉,掌握
11.PSP
| PSP2.1 | Personal Software Process Stages | 预估耗时(分钟) | 实际耗时(分钟) | 
|---|---|---|---|
| Planning | 计划 | 10 | 20 | 
| · Estimate | · 估计这个任务需要多少时间 | 10 | 10 | 
| Development | 开发 | 1495 | 1540 | 
| · Analysis | · 需求分析 (包括学习新技术) | 2h * 60 | 3h * 60 | 
| · Design Spec | · 生成设计文档 | 30 | 20 | 
| · Design Review | · 设计复审 (和同事审核设计文档) | 5 | 5 | 
| · Coding Standard | · 代码规范 (为目前的开发制定合适的规范) | 10 | 5 | 
| · Design | · 具体设计 | 30 | 30 | 
| · Coding | · 具体编码 | 12h * 60 | 10h * 60 | 
| · Code Review | · 代码复审 | 30 | 40 | 
| · Test | · 测试(自我测试,修改代码,提交修改) | 10h * 60 | 11h * 60 | 
| Reporting | 报告 | 70 | 60 | 
| · Test Report | · 测试报告 | 30 | 30 | 
| · Size Measurement | · 计算工作量 | 10 | 10 | 
| · Postmortem & Process Improvement Plan | · 事后总结, 并提出过程改进计划 | 30 | 20 | 
| 合计 | 1555 | 1630 | 
                    
                

                
            
        
浙公网安备 33010602011771号