computeotherprice.java
来自「该程序有17个java源文件。是经典奥斯波特艺术品商人软件工程例子」· Java 代码 · 共 51 行
JAVA
51 行
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 + =
减小字号Ctrl + -
显示快捷键?