码迷,mamicode.com
首页 > 其他好文 > 详细

结对编程

时间:2018-03-25 22:15:16      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:sha   成员   需求   iso   AC   自我   个人   action   list   

结对成员:

需求分析

需增加乘方开根号功能
重复式子的审查
括号运算符

思维导图

技术分享图片

核心代码

package test;
import java.util.*;
public class Calc{
public static void main(String args[]){
ArrayList

public void involution(String s) //乘方
{
String[] str=s.split("\^");
if(str[0].indexOf("/")>-1 || str[1].indexOf("/")>-1)//分数
{
String[] str1=str[0].split("\/");
String[] str2=str[1].split("\/");
if(Integer.parseInt(str1[1]) != 0)//分母不为零
{
int a=Integer.parseInt(str1[0]);
int b=Integer.parseInt(str1[1]);
int c=Integer.parseInt(str[1]);
double m=Math.pow(a, c);
double n=Math.pow(b, c);
result =simplefraction((int)m,(int)n);
}else{
throw new IllegalArgumentException("Divisor cannot be zero!");//除数为零时抛出异常
}
}
else{
if( Integer.parseInt(str[0])<1000&&Integer.parseInt(str[1])<1000&&Integer.parseInt(str[0])>-1000&&Integer.parseInt(str[1])>-1000)
{int a=Integer.parseInt(str[0]);
int b=Integer.parseInt(str[1]);
result = Math.pow(a,b) +"";
}
else{
throw new IllegalArgumentException("overrun!");//数值范围超出时抛出异常
}
}
}
public void sqrt(String s) //开根号
{ int sq=s.indexOf("!");
String str=s.substring(sq);
if(Integer.parseInt(str)>-1)
{
double a=Integer.parseInt(str);
result = Math.sqrt(a) +"";
}
else{
throw new IllegalArgumentException("overrun!");//数值范围超出时抛出异常
}
}

运行截图

技术分享图片

码云提交

技术分享图片

psp

PSP2.1 个人开发流程 预估耗费时间(分钟) 实际耗费时间(分钟)
Planning 计划 30 50
Estimate 明确需求和其他相关因素,估计每个阶段的时间成本 15 10
Development 开发 150 200
Analysis 需求分析 (包括学习新技术) 20 30
Design Spec 生成设计文档 20 20
Design Review 设计复审 10 10
Coding Standard 代码规范 10 10
Design 具体设计 30 30
Coding 具体编码 60 80
Code Review 代码复审 10 20
Test 测试(自我测试,修改代码,提交修改) 15 30
Reporting 报告 30 40
测试报告 10 10
计算工作量 10 5
并提出过程改进计划 10 15

总结

通过这次结对编程,不仅复习了一下从前所学,还学会了在讨论中改进代码,收获很大。

结对编程

标签:sha   成员   需求   iso   AC   自我   个人   action   list   

原文地址:https://www.cnblogs.com/muxueqianshan/p/8647185.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!