该宠物管理具有功能:
保存大量宠物信息 查看所有的宠物 通过名字查看某个宠物 输入宠物信息,录入系统中 修改系统中的宠物信息 删除宠物的信息 按年龄或价格进行排序代码如下:
Pet类public class Pet { private String name; private String gender; private String type; private int age; private int price; private int weight; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String getType() { return type; } public void setType(String type) { this.type = type; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } public int getWeight() { return weight; } public void setWeight(int weight) { this.weight = weight; } public Pet() { } public Pet(String name, String gender, String type, int age, int price, int weight) { this.name = name; this.gender = gender; this.type = type; this.age = age; this.price = price; this.weight = weight; } public void play(){ System.out.printf("宠物:%stt性别:%stt类型:%stt年龄:%dtt价格:%dtt重量:%dn", this.name,this.gender,this.type,this.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687