201571030103 小学四则运算练习软件项目报告
Github的仓库主页链接地址:https://github.com/djhdijd/Calculate.git
个人项目实施过程:
- 每个练习题至少要包含2种运算符,且不能出现负数和非整数。
- 练习题生成好后,将学号
- 当程序接收的参数为4时,以下为输出文件示例。

1 if (ope.isOperator(s)) 2 { 3 if (operators.isEmpty()) 4 { 5 operators.push(s); 6 } 7 else 8 { 9 if (ope.priority(operators.peek())<=ope.priority(s)&&!s.equals(")")) 10 { 11 operators.push(s); 12 } 13 else if(!s.equals(")")&&ope.priority(operators.peek())>ope.priority(s)) 14 { 15 while (operators.size()!=0&&ope.priority(operators.peek())>=ope.priority(s)&&!operators.peek().equals("(")) 16 { 17 if (!operators.peek().equals("(")) 18 { 19 String operator=operators.pop(); 20 sb.append(operator).append(" "); 21 output.push(operator); 22 } 23 } 24 operators.push(s); 25 } 26 27 else if (s.equals(")")) 28 { 29 while (!operators.peek().equals("(")) 30 { 31 String operator=operators.pop(); 32 sb.append(operator).append(" "); 33 output.push(operator); 34 } 35 operators.pop(); 36 } 37 } 38 } 39 else 40 { 41 sb.append(s).append(" "); 42 output.push(s); 43 } 44 }
操作符优先级的计算:
//计算操作符的优先级
public int priority(String s){
if(s=="+"||s=="-")
return 1;
if(s=="*"||s=="/")
return 1;
if(s=="("||s==")")
return 1;
else
return 0;
}
//计算
public int cal(int num1,int num2,String operator){
if(operator=="+")
return num1+num2;
if(operator=="-")
return num1-num2;
if(operator=="*")
return num1*num2;
if(operator=="/")
return num1/num2;
else
return 0;
}
|
PSP |
任务内容 |
计划完成需要的时间(min) |
实际完成需要的时间(min) |
|
Planning |
计划 |
10 |
20 |
|
· Estimate |
· 估计这个任务需要多少时间,并规划大致工作步骤 |
15 |
20 |
|
Development |
开发 |
150 |
200 |
|
·· Analysis |
需求分析 (包括学习新技术) |
60 |
80 |
|
· Design Spec |
· 生成设计文档 |
10 |
10 |
|
· Design Review |
· 设计复审 (和同事审核设计文档) |
10 |
15 |
|
· Coding Standard |
代码规范 (为目前的开发制定合适的规范) |
5 |
10 |
|
· Design |
具体设计 |
30 |
35 |
|
· Coding |
具体编码 |
100 |
100 |
|
· Code Review |
· 代码复审 |
10 |
10 |
|
· Test |
· 测试(自我测试,修改代码,提交修改) |
15 |
10 |
|
Reporting |
报告 |
30 |
20 |
|
·· Test Report |
· 测试报告 |
5 |
5 |
|
· Size Measurement |
计算工作量 |
3 |
3 |
|
· Postmortem & Process Improvement Plan |
· 事后总结 ,并提出过程改进计划 |
3 |
3 |


浙公网安备 33010602011771号