TestCase V2.0版本

package testcaseBuilderPackage2;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.text.DecimalFormat;


class TestDouble extends Test  {
File file=new File("e:/testcase1.txt");
double hmin = 1.0;
double hmax = 250.0;
double wmin = 0.1;
double wmax = 500.0;
getRandom gr1 = new getRandom();
getRandom gr2 = new getRandom();
DecimalFormat df = new DecimalFormat("0.00");

public void height() throws IOException {
Writer w=new FileWriter(file,true);
String s1="身高的有效等价类为:" +'\r'+'\n'+ df.format(gr1.getRandom1(hmin, hmax))
+ " ;  " + df.format(gr2.getRandom2(wmin, wmax))+'\r'+'\n';
String s2="无效等价类为:\r\n" + df.format(hmin - 1) + " ;  "
+ df.format(gr2.getRandom2(wmin, wmax)) + '\r'+'\n'
+ df.format(hmin) + " ;  "
+ df.format(gr2.getRandom2(wmin, wmax)) + '\r'+'\n'
+ df.format(hmax) + " ;  "
+ df.format(gr2.getRandom2(wmin, wmax)) + '\r'+'\n'
+ df.format(hmax + 1) + " ;  "
+ df.format(gr2.getRandom2(wmin, wmax))+'\r'+'\n';
w.write(s1);
w.write(s2);
w.close();
}

public void weight() throws IOException {
Writer w=new FileWriter(file,true);
String s3="体重的有效等价类为:\r\n" + df.format(gr1.getRandom1(hmin, hmax))
+ " ;  " + df.format(gr2.getRandom2(wmin, wmax))+'\r'+'\n';
String s4='\n' + "无效等价类为:\r\n"
+ df.format(gr1.getRandom1(hmin, hmax)) + " ;  "
+ df.format(wmin - 0.1) + '\r'+'\n'
+ df.format(gr1.getRandom1(hmin, hmax)) + " ;  "
+ df.format(wmin) + '\r'+'\n'
+ df.format(gr1.getRandom1(hmin, hmax)) + " ;  "
+ df.format(wmax) + '\r'+'\n'
+ df.format(gr1.getRandom1(hmin, hmax)) + " ;  "
+ df.format((wmax + 0.1))+'\r'+'\n';
w.write(s3);
w.write(s4);
w.close();
}
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值