标签:import exce 情况 ati void shel 注释 protect imp
1.测试帖链接
http://www.cnblogs.com/ElliotBaird/p/6596221.html
2.提出的问题、发现的缺陷
1)关键部分的注释可以适当多一些
(2)部分头文件没有使用到就不要一次性全部都包含进来了,如cstring,改程序中并没有string类型
3.修改后的代码
package test;
import java.util.Scanner;;
public class com {
public static float commission(int headphone,int shell,int protector){
float sum=headphone*80+shell*10+protector*8;
float com=0;
if(sum>=0&&sum<=1000){
com=(float) (sum*0.1);
}else if(sum<=1800){
com=(float) (100+(sum-1000)*0.15);
}else{
sum=(float) (220+(sum-1800)*0.2);
}
return com;
}
public static void main(String[] args) {
boolean b=true;
int headphone,shell,protector;
while(b){
System.out.println("请分别输入三种手机配件的销售情况:\n");
Scanner scanner = new Scanner(System.in);
try{
headphone=scanner.nextInt();
shell=scanner.nextInt();
protector=scanner.nextInt();
if(headphone<0 || shell<0 || protector<0){
if(headphone==-1){
System.out.println("退出");
break;
}else{
System.out.println("输入数量不满足条件");
}
}else{
float com=0;
com=commission(headphone,shell,protector);
System.out.println("佣金额为:"+com);
}}catch(java.util.InputMismatchException e){
System.out.println("输入的不是整数,请再次输入");
b = true;
}
}
}
}
4.修改后的心得体会
再严密的测试也不能完全发现软件当中所有的错误,但是测试还是能发现大部分的错误,能确保软件基本是可用的,所以在后续使用的过程中还需要加强快速响应的环节。结合软件测试的理论,故障暴露在最终客户端之前及时主动的去发现并解决
标签:import exce 情况 ati void shel 注释 protect imp
原文地址:http://www.cnblogs.com/lkx1995/p/6636170.html