?? futuretrendsreport.java
字號:
package Osbert;
import java.io.*;
public class FutureTrendsReport
{
public static void printReport (String tempFn, String tempLn) // displays a trend report for a specific painter
//
// displays a trend report for a specific painter
//
throws IOException {
DataInputStream soldFile; // stream object used for file input
Date oneLess = new Date(); // date one year ago today
GalleryPainting tempGallery; // temporary object used for file reading
int i=0;
oneLess.parseDate(Date.currentDate.toString());
oneLess.subtractOneYear ();
UserInterface.clearScreen ();
System.out.println("\n\n\t\t Report Date: " + Date.currentDate);
System.out.println("\t\t Osbert Oglesby - Collector of Fine Art");
System.out.println("\t\t TRENDS\n");
System.out.println("Painter: " + tempFn + " " + tempLn);
soldFile = new DataInputStream(new BufferedInputStream(new FileInputStream("sold.dat")));
tempGallery = new GalleryPainting();
//
// examine every sold painting of the current artist
// indicated by tempFn, tempLn
//
while (soldFile.available() != 0)
{
//
// read a painting object from the sold file
//
tempGallery.readSold (soldFile);
//
// check if the painting was sold within the past year
// and make sure it was painted by the current artist
//
if ((oneLess.compare(tempGallery.getSaleDate()) <= 0) &&
(UserInterface.compareStr (tempFn, tempGallery.getFirstName()) == 0) &&
(UserInterface.compareStr (tempLn, tempGallery.getLastName()) == 0))
{
//
// pause the screen after every three paintings
//
if (((i % 3) == 0) && (i != 0))
{
System.out.println("\n Press <ENTER> to view the next screen...");
UserInterface.pressEnter (); UserInterface.pressEnter ();
UserInterface.clearScreen ();
System.out.println("\n\t\t\t Report Date:" + Date.currentDate.toString());
System.out.println("\t\t\t Osbert Oglesby - Collector of Fine Art");
System.out.println("\t\t\t TRENDS\n");
System.out.println("Painter: " + tempFn + " " + tempLn);
}
System.out.println("--------------------------------------------------------------------");
System.out.print("CLASSIFICATION: ");
System.out.print(tempGallery.getClassification() + " ");
System.out.print("\t\tTITLE: " + tempGallery.getTitle());
System.out.println("\t\tSALE DATE: " + tempGallery.getSaleDate());
System.out.print("TARGET PRICE: " + tempGallery.getTargetPrice());
System.out.println("\t\tSELLING PRICE: " + tempGallery.getSellPrice());
i++;
} // if ((dateCompare (oneLess, saleDate) <= 0) &&
} // while (inFile.available() != 0)
System.out.println("\n Press <ENTER> to continue...");
UserInterface.pressEnter ();
soldFile.close ();
} // printReport
} // class FutureTrendsReport
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -