一, 预估与实际
PSP2.1 | Personal Software Process Stages | 预估耗时 (分钟) | 实际耗时 (分钟) |
---|---|---|---|
Planning | 计划 | 2h | 3h |
? Estimate | ? 估计这个任务需要多少时间 | 3d | 2.5d |
Development | 开发 | 2d | 2d |
? Analysis | ? 需求分析 (包括学习新技术) | 1d | 0.5d |
? Design Spec | ? 生成设计文档 | 3h | 1.5h |
? Design Review | ? 设计复审 | 1.5h | 1h |
? Coding Standard | ? 代码规范 (为目前的开发制定合适的规范) | 1h | 1h |
? Design | ? 具体设计 | 3h | 3h |
? Coding | ? 具体编码 | 2d | 2d |
? Code Review | ? 代码复审 | 2h | 1h |
? Test | ? 测试 (自我测试, 修改代码, 提交修改) | 2h | 1h |
Reporting | 报告 | 0.5h | 1h |
? Test Repor | ? 测试报告 | 2h | 0.5h |
? Size Measurement | ? 计算工作量 | 0.5h | 0.5h |
? Postmortem & Process Improvement Plan | ? 事后总结, 并提出过程改进计划 | 2h | 1h |
合计 3d | 3d |
二, 需求分析
特点 1
- 小学一年级学到 100 以内加减法, 最大 99
我通过上网搜索的方式了解到, 小学二年级数学有如下的几个特点:
特点 1
- 小学二年级学到一百内加减法.
特点 2
- 小学二年级学到九九乘法表的表内乘除法.
特点 3
- 小学二年级学到整百整千加减法.
特点 4
小学二年级学到几百几十加减整百或整十数.
特点 5
小学三年级学习三位数乘除两位数的计算, 以及加减法计算, 加减法计算无要求.
经过分析, 我认为, 这个程序应当:
对一年级题来说, 数字小于 100, 只有加减法.
对二年级题来说, 使用的数字小于 10000;100 内加减随意;
整百整千加减随意;
过百整数加减整百或整十;
乘时数字 1-9;
除时要得出商和余数.
对三年级来说, 数字在 100 至 999 之间, 乘除法题. 被乘数与被除数为两位数.
- 加减法题没有什么限制.
三, 设计
1. 设计思路
说明你如何设计这个程序
比如:
这个程序在上一个用于计算小学一二年级的加减乘除法题的基础上加上计算三年级的乘除法题.
三年级的乘除法题数字在 100 至 999 之间, 乘除法题. 被乘数与被除数为两位数.
在加减计算题上, 三年级没有什么数字大小限制.
关键函数的流程图是怎样的?
2. 实现方案
准备工作: 先在 Github 上创建仓库, 克隆到本地, 仔细阅读题目要求, 上网查找关于小学一二年级及三年级数学题目的出题范围和他们的学习范围.
技术关键点: 将想要输入到 txt 文件上的题目与答案一次性输入到 txt 文件中, 不逐条输入.
将括号加入四则运算. 结果不能为负.
- String c[] ={"+","-","*","÷"};
- byte contentInBytes[];
- Random rand=new Random();
- for (int i=0;i<=n;i++) {
- int a=rand.nextInt(c.length);
- String resultChar=c[a];// 运算符号存入 resultChar
- if (grade==1) {
- for (int i1=0;i1<=n;i1++) {
- left=rand.nextInt(100);
- right=rand.nextInt(100);// 左右百内随机数
- String b= left+resultChar+right+"=";// 题目
- // 又一套, 存题目
- if(resultChar=="+"){
- re3=left+right;
- String d=left+resultChar+right+"="+re3;
- }else if(resultChar=="-"){
- re3=left-right;
- String e=left+resultChar+right+"="+re3;
- }
- }
- }
- if (grade==2) {
- for (int i2=0;i2<=n;i2++) {
- if(resultChar=="+"){
- left=rand.nextInt(10000);
- right=rand.nextInt(10000);
- String b= left+resultChar+right+"=";
- if((left%100==0 || left%1000==0 || left<=100)&&(right%100==0 || right%1000==0 || right<=100)) {
- re3=left+right;
- String e=left+resultChar+right+"="+re3;
- }
- if(left%100==0 && left>=100 && (right%100==0 || right%10==0)) {
- re3=left+right;
- String f=left+resultChar+right+"="+re3;
- }
- }else if(resultChar=="-"){
- left=rand.nextInt(10000);
- right=rand.nextInt(10000);
- String b= left+resultChar+right+"=";
- if((left%100==0 || left%1000==0 || left<=100)&&(right%100==0 || right%1000==0 || right<=100)) {
- re3=left-right;
- String g=left+resultChar+right+"="+re3;
- }
- if(left%100==0 && left>=100 && (right%100==0 || right%10==0)) {
- re3=left-right;
- String h=left+resultChar+right+"="+re3;
- }
- }else if(resultChar=="*"){
- left=rand.nextInt(10)+1;
- right=rand.nextInt(10)+1;
- String b= left+resultChar+right+"=";
- re3=left-right;
- String j=left+resultChar+right+"="+re3;
- }else if(resultChar=="÷"){
- left=rand.nextInt(10)+1;
- right=rand.nextInt(10)+1;
- String b= left+resultChar+right+"=";
- re2=left/right;
- re1=left%right;
- String k=left+resultChar+right+"=";
- if(re1==0) {
- re3=left/right;
- String l=left+resultChar+right+"="+re3;
- }
- else {
- String m=left+resultChar+right+"="+(re1+"..."+re2);
- }
- }
- }
- }
- if (grade==3) {
- for (int i3=0;i3<=n;i3++) {
- if(resultChar=="+"){
- left=rand.nextInt(10000);
- right=rand.nextInt(10000);
- re3=left+right;
- String o= left+resultChar+right+"="+re3;
- }
- if(resultChar=="-") {
- left=rand.nextInt(10000);
- right=rand.nextInt(10000);
- re3=left-right;
- String o= left+resultChar+right+"="+re3;
- }
- if(resultChar=="*") {
- left=rand.nextInt(1000)+100;
- right=rand.nextInt(100)+10;
- re3=left*right;
- String o= left+resultChar+right+"="+re3;
- }
- if(resultChar=="÷") {
- left=rand.nextInt(1000)+100;
- right=rand.nextInt(100)+10;
- re3=left/right;
- String o= left+resultChar+right+"="+re3;
- re2=left/right;
- re1=left%right;
- if(re1==0) {
- String p=left+resultChar+right+"="+re3;
- }
- else {
- String p=left+resultChar+right+"="+(re1+"..."+re2);
- }
来源: http://www.bubuko.com/infodetail-2773116.html