📄 computeotherprice.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 + -