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

📄 secondsortflooring.java

📁 Java the UML Way 书中所有源码
💻 JAVA
字号:
/*
 * SecondSortFlooring.java   E.L. 2001-08-19
 *
 */

final class SecondSortFlooring extends Flooring2 {
  public static final double limitHighDiscount = 5;
  public static final double highDiscount = 0.7;
  public static final double lowDiscount = 0.5;
  public static final double materialAddendum = 1.2; // factor because of risk for waste

  public SecondSortFlooring(String initName, double initPrice, double initWidth) {
    super(initName, initPrice, initWidth);
  }

  public double getTotalPrice(Surface aSurface) {
    double basicPrice = super.getTotalPrice(aSurface);
    double req = getMaterialReq(aSurface);
    if (req > limitHighDiscount) return basicPrice * (1.0 - highDiscount);
    else return basicPrice * (1.0 - lowDiscount);
  }

  public double getMaterialReq(Surface aSurface) {
    double basicReq = super.getMaterialReq(aSurface);
    return basicReq * materialAddendum;
  }
}

⌨️ 快捷键说明

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