package test;
import java.util.Scanner;
import org.junit.Test;
public class JTest {
@Test
public void test4(){//随机生成一个1-100之间的整数
System.out.print("生成的年龄是:");
//double d=Math.random();
int x=(int)(Math.random()*100+1);
System.out.println(x);//测试生成的整数
if(x<18){
System.out.println("少年时期");
}else if(x>18&&x<40){
System.out.println("青年时期");
}else if(x>40&&x<50){
System.out.println("中年时期");
}else if(x>50&&x<80){
System.out.println("老年时期");
}else{
System.out.println("其他时期");
}
}
}