import java.util.Scanner;
public class javas2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入狗狗的年龄");
int a = sc.nextInt();
if (a>0 && a<2){
System.out.println("狗狗的年龄相当于人的年龄"+(a*10.5));
}
else if (a>2){
System.out.println("狗狗的年龄相当于人的年龄"+(2*10.5+(a-2)*4));
}
else {
System.out.println("输入错误");
}
}
}
![](https://i-blog.csdnimg.cn/blog_migrate/4508c43d8f7608a268c4dcf7cadd8661.png)