package first; public class Animal {public static void main(String[] args) {Pet p1=new Pet("tao","r",1);Pet p2=new Pet("tai","r",1);Pet p3=new Pet("tap","r",1);PetShop ps=new PetShop();} } class PetShop{private Pet pet[];private int num;/** * 寻找动物 */public Pet[] search(String name) {int count=0;for(int i=0;i<this.pet.length;i++) {if(this.pet[i]!=null) {if(pet[i].getName()=name) {count++;}}}}public void sell() {}public void cutHair() {}public void reGoods() {}/** * 进货 * @param pet */public void addpet(Pet pet) {if(num<this.pet.length) {this.num++;}else {System.out.println("无法添加已经满员");}} } class Pet{private String name;private String color;private int age;public Pet(String name, String color, int age) {this.name = name;this.color = color;this.age = age;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getColor() {return color;}public void setColor(String color) {this.color = color;}public int getAge() {return age;}public void setAge(int age) {this.age = age;} }
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778