结对项目
四则运算
| 这个作业属于哪个课程 | https://edu.cnblogs.com/campus/gdgy/InformationSecurity1912-Softwareengineering |
|---|---|
| 这个作业要求在哪里 | https://edu.cnblogs.com/campus/gdgy/InformationSecurity1912-Softwareengineering/homework/12147 |
| 这个作业的目标 | 自动生成四则运算题目的命令行程序 |
| 姓名 | 学号 | github |
|---|---|---|
| 黄颖睿 | 3119005416 | https://github.com/VONVINRUI/3119005416 |
PSP表格
| PSP2.1 | Personal Software Process Stages | 预估耗时(分钟) | 实际耗时(分钟) |
|---|---|---|---|
| Planning | 计划 | 40 | 40 |
| · Estimate | · 估计这个任务需要多少时间 | 40 | 50 |
| Development | 开发 | 720 | 800 |
| · Analysis | · 需求分析 (包括学习新技术) | 30 | 40 |
| · Design Spec | · 生成设计文档 | 40 | 40 |
| · Design Review | · 设计复审 | 20 | 20 |
| · Coding Standard | · 代码规范 (为目前的开发制定合适的规范) | 10 | 20 |
| · Design | · 具体设计 | 60 | 60 |
| · Coding | · 具体编码 | 700 | 800 |
| · Code Review | · 代码复审 | 30 | 30 |
| · Test | · 测试(自我测试,修改代码,提交修改) | 90 | 120 |
| Reporting | 报告 | 40 | 60 |
| · Test Repor | · 测试报告 | 20 | 20 |
| · Size Measurement | · 计算工作量 | 10 | 10 |
| · Postmortem & Process Improvement Plan | · 事后总结, 并提出过程改进计划 | 10 | 20 |
| · 合计 | 1810 | 2190 |
效能分析


设计实现过程
类
1、ArithmeticTree类:
接口:
ArithmeticTree(int operatorNumber, int answerRange):规定运算符的个数以及生成数的范围,生成表达式
generateNode(int number):构建生成四则运算表达式的二叉树
calculate(String operator, FractionOperation leftFraction, FractionOperation rightFraction):进行两个元素的计算
print(DataNode localRootNode):中序遍历二叉树
2、FractionOperation类:
接口:
FractionOperation(int a, int b):设置分子分母
generateFraction():生成计算数
add(FractionOperation right):加法
subtract(FractionOperation right):减法
multiply(FractionOperation right):乘法
divide(FractionOperation right):除法
setAB(int a, int b):调整分子分母
3、DataNode类:
接口:
DataNode():存放数据的节点
4、OperatorNode类:
接口:
OperatorNode(DataNode left, DataNode right, String operator):存放操作符的节点
5、Main
主函数,获取数据,生成结果。
6、FileUtils类
接口:
writeTitle(PrintWriter printWriter, Map<String,String> map):将题目写入文件
writeAnswer(PrintWriter printWriter,Map<String,String> map):将答案写入文件
compare(File answerFile, File exerciseFile):对比
7、GenerateUtils类
接口:
getRandomInRange(int range):获取随机数
generateMap(int examNumber, int answerRange):随机生成四则运算
代码说明
Main


FractionOperation


FileUtils

ArithmeticTree

测试运行




项目小结
对这次的项目,开始觉得挺难的,查阅了许多资料,重新学习了二叉树的知识。

浙公网安备 33010602011771号