语句覆盖:abc 测试用例:X=1,Y=2
分支覆盖:aeg 测试用例:X=4,Y=0
import java.util.Scanner;
public class Da {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
System.out.print("请输入x: ");
int x = in.nextInt();
Scanner in1 = new Scanner(System.in);
System.out.print("请输入y: ");
int y = in1.nextInt();
Xiao xiao=new Xiao();
xiao.Way(x, y);
}
}
public class Xiao {
public void Way(int x,int y){
if((x<4 || y>0)&&(y>1)){
y=y+1;
}
else {
if(x>=5){
x=x-y;
}
else{
x=x+y;
}
}
if((x<4 || y>0)&&(y<1 || y==1)){
}
System.out.println("x的值为:"+x);
System.out.println("y的值为:"+y);
}
}
时间: 2024-10-08 12:45:04