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

📄 computeotherprice.java

📁 该程序有17个java源文件。是经典奥斯波特艺术品商人软件工程例子
💻 JAVA
字号:
package Osbert;
import java.io.*;

public class ComputeOtherPrice
{

  public static double getAlgorithmPrice (GalleryPainting other)	// determines the maximum price to be offered for an "other" painting
  //
  // determines the maximum price to be offered for an "other" piece of work
  //
  throws IOException {

	DataInputStream inFile;		// stream object used for file input
	double fashionCoefficient;	// current coefficient of painting artist
	Fashionability tempFash;	// temp. fashionability object used for file reading

	fashionCoefficient = 0.0;

	inFile = new DataInputStream(new BufferedInputStream(new FileInputStream("fash.dat")));
    tempFash = new Fashionability();

		//
		// loop through the fashionability file to find a match with the artist
		//
		while (inFile.available() != 0)
		{
			//
			// read in an object from the fashionability file
			//
			tempFash.readFash (inFile);

			//
			// check if there is a match with the current other object
			//
			if ((UserInterface.compareStr (tempFash.getFirstName (), other.getFirstName()) == 0) &&
				(UserInterface.compareStr (tempFash.getLastName (), other.getLastName())  == 0))
			{
				fashionCoefficient = tempFash.getCoefficient ();
				break;
			}

		} // while (!inFile.eof ())

		inFile.close ();

	return fashionCoefficient * other.getHeight() * other.getWidth();

  } // getAlgorithmPrice

} // class ComputeOtherPrice

⌨️ 快捷键说明

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