📄 chicken.java
字号:
package company.animal.feet;
public class Chicken extends company.animal.feet.Feet{
private int totalChicken;
private int totalEgg;
private double revenue;
public Chicken(String habitat, boolean produceEgg, boolean produceMeat,
boolean produceMilk, int foot) {
super(habitat,produceEgg, produceMeat, false, foot);
}
public void setTotalChicken(int totalChicken) {
this.totalChicken = totalChicken;
calculateRevenue();
}
public void setTotalEgg(int totalEgg) {
this.totalEgg = totalEgg;
calculateRevenue();
}
public int getTotalChicken() {
return totalChicken;
}
public int getTotalEgg() {
return totalEgg;
}
private void calculateRevenue() {
this.revenue =company.animal.RevenueCalculation.CalculateChickenRev
(totalChicken, totalEgg);
}
public String getInfo () {
String info = "\n"+"Chicken"+"\n"+"Habitat: " + super.getHabitat() + "\n" +
"Produce Egg: " + super.getProdEgg() + "\n" +
"Produce Meat: " + super.getProdMeat() + "\n" +
"Produce Milk: " + super.getProdMilk() + "\n" +
"Total Chicken: " + this.totalChicken + "\n" +
"Total Egg: " + this.totalEgg + "\n" +
"Revenue: " + this.revenue;
return info;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -