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

📄 investor.java

📁 Java程序设计大学教程程序源代码
💻 JAVA
字号:
/**
 * <p>Title: 果园系统——投资者类</p>
 *
 * <p>Description: 教学演示程序</p>
 * <p>演示一个较复杂一点的面向对象应用程序的设计过程</p>
 * <p>帮助学生理解接口编程</p>
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: 刘艺</p>
 *
 * @author 刘艺
 * @version 1.0
 */

package jbookch4.gardensys2;

public class Investor {
    public Investor(String name) {
        this.name = name;
    }

    public static void main(String[] args)  {
        Investor theInvestor = new Investor("休闲果园开投资公司");
        float g = theInvestor.getProfits();
        System.out.println(theInvestor.name + "投资总收益为" + g);
    }

    public float getProfits() {
        float sum = 0;
        profits[0] = new Realestate("果园别墅", 200000);
        profits[1] = new Realestate("温室", 100000);
        profits[2] = new Fruit("葡萄", 8000);
        profits[3] = new Fruit("香蕉", 100000);
        for (int i = 0; i < profits.length; i++) {
            sum += profits[i].gain();
        }
        return sum;
    }

    private IGain[] profits = new IGain[4];
    private String name;
}

⌨️ 快捷键说明

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