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

📄 fish.java

📁 This is the inheritance model in java.
💻 JAVA
字号:
package company.animal.nofeet;

public class Fish extends company.animal.nofeet.NoFeet {
         private int totalFish;
		 private double revenue;
		 
    public Fish(String habitat,boolean produceEgg, boolean produceMeat, boolean produceMilk, int fin) {
          super(habitat,false, produceMeat,false, fin);
            }
    public void setTotalFish(int totalFish) {
	   this.totalFish = totalFish;
	   calculateRevenue();
     }	
    public int getTotalFish() {
	   return totalFish;
      }
     private void calculateRevenue() {
	
	 this.revenue = company.animal.RevenueCalculation.CalculateFishRev(this.totalFish);
                  }	 
      
     public String getInfo () {
	      String info = "\n"+"\n"+"Fish"+"\n"+"Habitat: " + super.getHabitat() + "\n" +
				  "Total fish: " + this.totalFish + "\n" +
				  "Revenue: " + this.revenue + "\n";
	    return info;
	  }
	
}
			

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -