您的位置:首页 > 其它

四则运算 测试与封装 (完善) 5.2 5.3

2015-05-07 17:34 375 查看
一、结对小伙伴:陈淑筠 http://www.cnblogs.com/babybluecsj/

二、(1)我用小伙伴上一次5.1的作业来单元测试,发现当除数为零时,运行时未抛出异常,于是我们加上了

1.     if
(fh2==
'/'
){


(3).在此,我们还增加了答案精确到了小数后一位:

static
double
answer=
0
.0d;


public
static
double
Onefhnum(
int
a,
int
b,
int
e)
throws
Exception{
//一个运算符的方法


public
static
double
Twofhnum(
int
a,
int
b,
int
c,
int
e,
int
h)
throws
Exception{
//两个运算符的方法


public
static
double
Threefhnum(
int
a,
int
b,
int
c,
int
d,
int
e,
int
h,
int
f)
throws
Exception{
//三个运算符的方法


(4).由于时间原因,在代码中增加了:
int
precision =
0
;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: