⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chicken.java

📁 This is the inheritance model in java.
💻 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 + -