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

📄 futuretrendsreport.java

📁 该程序有17个java源文件。是经典奥斯波特艺术品商人软件工程例子
💻 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 + -