import java.util.Scanner;

public class AdoptPet
{	
	public static void main(String[] args) 
	{
		String name;
		int health, love;		
		Scanner sc = new Scanner(System.in);
		System.out.println("欢迎来到宠物店！");
		System.out.print("请输入要领养宠物的名字：");
		name = sc.next();
		System.out.print("请输入要领养宠物的类型：(1.狗狗 2.企鹅)：");
		int choose = sc.nextInt();
		switch (choose)
		{
			case 1:
				System.out.print("请输入狗狗的品种：（1.聪明的拉布拉多 2.酷酷的雪纳瑞）");
				int choose1 = sc.nextInt();
				System.out.print("请输入狗狗的健康值(1~100之间)：");
				health = sc.nextInt();
				if (health > 100 || health < 1)
				{
					System.out.println("健康值应该在1-100之间，默认值是60");
					Dog d = new Dog(name, 60);
					switch (choose1)
					{
						case 1:
							d.setStrain("聪明的拉布拉多");
							d.show();
							break;
						case 2:
							d.setStrain("酷酷的雪纳瑞");
							d.show();
							break;
						default:
							System.out.println("输入有误！");
							break;
					}		
				}
				else
				{
					Dog d = new Dog(name, health);
					switch (choose1)
					{
						case 1:
							d.setStrain("聪明的拉布拉多");
							d.show();
							break;
						case 2:
							d.setStrain("酷酷的雪纳瑞");
							d.show();
							break;
						default:
							System.out.println("输入有误！");
							break;
					}		
				}						
				break;

			case 2:
				System.out.print("请输入企鹅的性别：（1.Q仔 2.Q妹）");
				choose1 = sc.nextInt();
				System.out.print("请输入企鹅的健康值(1~100之间)：");
				health = sc.nextInt();
				if (health > 100 || health < 1)
				{
					System.out.println("健康值应该在1-100之间，默认值是60");
					Penguin p = new Penguin(name, 60);
					switch (choose1)
					{
						case 1:
							p.setSex("Q仔");
							p.show();
							break;
						case 2:
							p.setSex("Q妹");
							p.show();
							break;
						default:
							System.out.println("输入有误！");
							break;
					}		
				}
				else
				{
					Penguin p = new Penguin(name, health);
					switch (choose1)
					{
						case 1:
							p.setSex("Q仔");
							p.show();
							break;
						case 2:
							p.setSex("Q妹");
							p.show();
							break;
						default:
							System.out.println("输入有误！");
							break;
					}
				}						
				break;

			default:
			System.out.print("输入有误!");
			break;
		}
		sc.close();
	}
}

class Pet
{
	private String name;
	private int health;
	private int love = 0;

	public Pet(String name, int health)
	{
		this.name = name;
		this.health = health;
	}

	public String getName()
	{
		return this.name;
	}


	public int getHealth()
	{
		return this.health;
	}

	public int getLove()
	{
		return this.love;
	}

	public void show()
	{
		System.out.println("宠物的自白：");
		System.out.println("我的名字叫" + getName() + ",健康值是" + getHealth() + ",和主人的亲密度是" + getLove());
	}

}
class Dog extends Pet
{
	private String strain;

	public Dog (String name, int health)
	{
		super(name, health);
	}

	public String getStrain()
	{
		return this.strain;
	}

	public void setStrain(String strain)
	{
		this.strain = strain;
	}

	//重写父类方法
	public void show()
	{
		super.show();
		System.out.println("我是一只" + getStrain());
	}
}

class Penguin extends Pet
{
	private String sex;

	public Penguin(String name, int health)
	{
		super(name, health);
	}

	public String getSex()
	{
		return this.sex;
	}

	public void setSex(String sex)
	{
		this.sex = sex;
	}

	//重写父类方法
	public void show()
	{
		super.show();
		System.out.println("我的性别是" + getSex());
	}
}