computemasterworkprice.java

来自「该程序有17个java源文件。是经典奥斯波特艺术品商人软件工程例子」· Java 代码 · 共 36 行

JAVA
36
字号
package Osbert;

import java.io.*;

public class ComputeMasterworkPrice
{

  public static double getAlgorithmPrice (GalleryPainting masterwork)
  //
  // determines the maximum price to be offered for a masterwork
  //
  throws IOException {

    int	century;	        // century in which painting was created
    double masterpiecePrice;	// value if masterpiece

	//
	// first, compute the price of the painting as if it were a masterpiece
	//
	masterpiecePrice = ComputeMasterpiecePrice.getAlgorithmPrice (masterwork);

	//
	// next, obtain the century in which the painting was created and adjust
	// the price based upon the century
	//
	century = masterwork.getPaintDate().getYear() / 1000;

	if (century == 19)
		return masterpiecePrice * 0.25;
	else
		return masterpiecePrice * (21 - century) / (22 - century);

  } // getAlgorithmPrice

} // class ComputeMasterworkPrice

⌨️ 快捷键说明

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