package com.shangji1.P155;
/**
*
* 把多个企鹅的信息添加到集合中,查看企鹅的数量,遍历所有企鹅的信息,
* 删除集合中部分企鹅的元素,判断集合中是否包含指定企鹅。
*
*/
public class Penguin {
private String name; // 企鹅姓名
private int health; // 健康值
private int love; // 亲密度
private String sex; // 性别
//创建构造方法
public Penguin() {
super();
}
public Penguin(String name, String sex) {
super();
this.name = name;
this.sex = sex;
}
public Penguin(String name, int health, int love, String sex) {
super();
this.name = name;
this.health = health;
this.love = love;
this.sex = sex;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getHealth() {
return health;
}
public void setHealth(int health) {
this.health = health;
}
public int getLove() {
return love;
}
public void setLove(int love) {
this.love = love;
}
public String getSex() {
re
使用java实现面向对象编程第六章上机练习1、2
最新推荐文章于 2022-11-26 11:36:18 发布