四则运算
计划:实现四则运算
开发:
public interface TwoNumber {
public int Add(int a,int b);
public int Reduce(int a,int b);
public int Ride (int a,int b);
public int Except (int a,int b);
}
public class Algorithm implements TwoNumber{
//加法运算
public int Add(int a,int b) {
return a+b;
}
//减法运算
public int Reduce(int a,int b) {
return a-b;
}
//乘法运算
public int Ride (int a,int b) {
return a*b;
}
//除法运算
public int Except (int a,int b) {
return a/b;
}
}
//测试
public class TestAlgorithm{
@Test
public void test() {
Algorithm a = new Algorithm();
int add = a.Add(2, 3);
int reduce=a.Reduce(3,2);
int Ride =a.Ride (2,3);
int Except =a.Except (6,3);
assertEquals(5, add);
assertEquals(1, Reduce);
assertEquals(6, Ride);
assertEquals(2, Except);
}
测试报告:无法计算小数。
事后总结:开发过程较慢。
PSP阶段 |
实际花费时间百分比 |
估计花费时间百分比 |
计划 |
3 |
2 |
明确需求和其他相关因素,估计每个阶段的时间成本 |
3 |
2 |
开发 |
90 |
90 |
需求分析 |
6 |
4 |
生成设计文档 |
4 |
5 |
设计复审(和同事审核设计文档) |
4 |
5 |
代码规范(为目前的开发制定合适的规范) |
2 |
3 |
具体设计 |
15 |
20 |
具体代码 |
35 |
35 |
代码复审 |
12 |
8 |
测试(自测,修改代码,提交修改) |
12 |
10 |
报告 |
7 |
8 |
测试报告 |
3 |
3 |
计算工作量 |
2 |
2 |
事后总结,并提出过程改进计划 |
2 |
3 |