亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? userinterface.java

?? 該程序有17個java源文件。是經典奧斯波特藝術品商人軟件工程例子
?? JAVA
字號:
package Osbert;
import java.io.*;

public class UserInterface {

  public static char getChar()
  //
  // returns a char from the keyboard
  //
  {

    char ch = ' ';	// char return value

    try
	{
	  ch = (char) (System.in.read ());
    }
    catch (Exception e)
    {
      System.out.println ("***** Error: getChar () *****");
      System.out.println ("\t" + e);
    }

    return ch;

  } // getChar

//----------------------------------------------------------------------------------------------------------------------------------------------------


  public static String getString()
  //
  // returns a string from the keyboard
  //
  {

    String message = new String();

	try
	{
      BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
	  message = stdin.readLine();
      while(message.length() < 1)
        message = stdin.readLine();
	}
    catch (Exception e)
    {
		System.out.println ("***** Error: getString () *****");
		System.out.println ("\t" + e);
    }
    return message;

  }  // getString
//----------------------------------------------------------------------------------------------------------------------------------------------------

  public static int getInt()
  //
  // returns an integer from the keyboard
  //
  {
  	String tempStr = new String(); // temporary string value
  	int    ret;                    // converted int used as return value
  	tempStr = getString();
  	ret = Integer.parseInt(tempStr);
  	return ret;

  }  // getInt

//----------------------------------------------------------------------------------------------------------------------------------------------------

  public static double getDouble()
  //
  // returns a double from the keyboard
  //
  {
	String tempStr = new String();    // temporary string value
	double    ret;                    // converted int used as return value

	tempStr = getString();

	ret = Double.parseDouble(tempStr);

	return ret;

  }  // getDouble

//----------------------------------------------------------------------------------------------------------------------------------------------------

  public static void pressEnter()
  //
  // waits until the user presses the <ENTER> key
  //
  {
	byte choice[] = new byte[5];  // dummy variable used to induce user input

	try
	{
	  System.in.read (choice);
    }
    catch (Exception e)
    {
	  System.out.println ("***** Error: pressEnter () *****");
	  System.out.println ("\t" + e);
      } // try

  } // pressEnter

//----------------------------------------------------------------------------------------------------------------------------------------------------

  public static void clearScreen ()
  //
  // clearScreen clears the screen
  //
  {
    int	i;		// loop counter representing the number of blank lines to be printed

    //
    // Implementation-dependent code to clear the screen should replace the code
    // given below.
    //
    for (i = 0; i < 26; i++)
    {
      System.out.println ();
    }
  }  // clearScreen ()

//----------------------------------------------------------------------------------------------------------------------------------------------------

  public static void displayMainMenu ()
  //
  //displays the main menu containing all the options available to the user
  //
  throws IOException {
    boolean done = false;		// terminates while loop
    char choice;;				// user's choice
    GalleryPainting painting;   // painting object to be sold
    while (!done)
    {
      clearScreen ();

      System.out.println ("\t               MAIN MENU\n\n");
      System.out.println ("\t  Osbert Oglesby - Collector of Fine Art\n\n");
      System.out.println ("\t            1. Buy a Painting\n");
      System.out.println ("\t            2. Sell a Painting\n");
      System.out.println ("\t            3. Produce a Report\n");
      System.out.println ("\t            4. Quit\n\n");
      System.out.print ("Enter your choice and press <ENTER>: ");
      choice = getChar();
      switch (choice)
      {
          case '1':
            displayBuyPaintingMenu();
            break;

          case '2':
            painting = new GalleryPainting();
            painting.sell();
            break;

          case '3':
            displayReportMenu();
            break;

          case '4':
          case '\n':
            done = true;
            break;

          default:
            System.out.println ("\n\nNot a valid choice\n");
            System.out.println ("Press <ENTER> to return to menu...");
            pressEnter();
            break;

      } // switch
    } // while

  } //displayMainMenu

//----------------------------------------------------------------------------------------------------------------------------------------------------

  public static void displayBuyPaintingMenu ()
  //
  // allows user to select the type of painting to be purchased
  //
  throws IOException {

	boolean done = false;		// terminates do-loop
	char choice;				// user's choice
	Masterpiece	masterpiece;	// item to be bought
	Masterwork masterwork;		// item to be bought
	Other other;				// item to be bought
	Fashionability fash;		// item to be updated

	while (!done)
	{
	  clearScreen ();

	  System.out.println ("\t               BUY PAINTING MENU\n\n");
	  System.out.println ("\t  Osbert Oglesby - Collector of Fine Art\n\n");
	  System.out.println ("\t            1. Buy a Masterpiece\n");
	  System.out.println ("\t            2. Buy a Masterwork\n");
	  System.out.println ("\t            3. Buy an Other Painting\n");
	  System.out.println ("\t            4. Update Fashionability Coefficient\n");
	  System.out.println ("\t            5. Return to Main Menu\n\n");
	  System.out.print ("Enter your choice and press <ENTER>: ");
      choice = getChar();
      switch (choice)
      {

		  case '1':
		    masterpiece = new Masterpiece();
			masterpiece.buy();
			break;

		  case '2':
		    masterwork = new Masterwork();
			masterwork.buy();
			break;

		  case '3':
		    other = new Other();
			other.buy();
			break;

		  case '4':
		    fash = new Fashionability();
            fash.addNewFash();
            break;

          case '5':
		  case '\n':
			done = true;
			break;

		  default:
			System.out.println ("\n\nNot a valid choice\n");
			System.out.println ("Press <ENTER> to return to menu...");
            pressEnter();
			break;

      } // switch

	} // while

  } //displayBuyPaintingMenu

//----------------------------------------------------------------------------------------------------------------------------------------------------

  public static void displayReportMenu ()
  //
  // allows user to select the type of painting to be purchased
  //
  throws IOException {

	boolean done = false;		// terminates do-loop
	char choice;				// user's choice
	GalleryPainting	painting;	// item used to invoke report

	while (!done)
	{

	  clearScreen ();

	  System.out.println ("\t               REPORT MENU\n\n");
	  System.out.println ("\t  Osbert Oglesby - Collector of Fine Art\n\n");
	  System.out.println ("\t            1. Report on Bought Paintings\n");
	  System.out.println ("\t            2. Report on Sold Paintings\n");
	  System.out.println ("\t            3. Report on Trends\n");
	  System.out.println ("\t            4. Return to Main Menu\n\n");
	  System.out.print ("Enter your choice and press <ENTER>: ");

	  choice = getChar();

	  switch (choice)
	  {

		  case '1':
			PurchasesReport.printReport();
		    pressEnter();
			break;

		  case '2':
			SalesReport.printReport();
		    pressEnter();
			break;

		  case '3':
			ComputeFutureTrends.compute();
		    pressEnter();
			break;

		  case '4':
		  case '\n':
			done = true;
			break;

		  default:
			System.out.println ("\n\nNot a valid choice\n");
			System.out.println ("Press <ENTER> to return to menu...");
			pressEnter();
			break;

	  } // switch

	} // while

  } //displayReportMenu

//-------------------------------------------------------------------------------------------------------------------

  public static int compareStr (String str1, String str2)	// represents the two strings to compare
  //
  // compares two strings in the same manner as strcmp while ignoring any
  // question marks
  //
  {
	String temp1 = str1, temp2 = str2;	// represents strings void of any question marks

	//
	// remove all question marks from both strings
	//
	temp1 = removeChar (temp1, '?');
	temp2 = removeChar (temp2, '?');

	//
	// compare the two strings without question marks
	//
	return temp1.compareTo(temp2);

  } // compareStr

//-------------------------------------------------------------------------------------------------------------------

  private static String removeChar(String str, char c)
  //
  // remove all question marks from a string
  //
  {

     String temp = new String();

     for (int i = 0; i < str.length(); i ++)
	   if (str.charAt(i) != c) temp += str.charAt(i);

	 return temp;

  } // removeQ

//-------------------------------------------------------------------------------------------------------------------

  public static void initiateFiles()
  throws IOException {

    File fileExists;
	DataOutputStream createFile;

	fileExists = new File("fash.dat");
    if(!fileExists.exists())
    {
      createFile = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("fash.dat")));
      createFile.close();
    }

	fileExists = new File("artist.dat");
	if(!fileExists.exists())
	{
	  createFile = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("artist.dat")));
	  createFile.close();
	}

	fileExists = new File("sold.dat");
	if(!fileExists.exists())
	{
	  createFile = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("sold.dat")));
	  createFile.close();
	}

	fileExists = new File("gallery.dat");
	if(!fileExists.exists())
	{
	  createFile = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("gallery.dat")));
	  createFile.close();
	}

	fileExists = new File("auction.dat");
	if(!fileExists.exists())
	{
	  createFile = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("auction.dat")));
	  createFile.close();
	}

  }

//-------------------------------------------------------------------------------------------------------------------

  public static void addArtist (String fn, String ln)	// first/last name of artist to be added
  //
  // inserts an artist name into the artist file
  //
  throws IOException {
	DataInputStream inTmp, inCopy;		// stream objects used for file input
	DataOutputStream outTmp, outCopy;	// stream objects used for file output
	String tempFn;						// temporary string used for file copying
	String tempLn;						// temporary string used for file copying
	boolean found = false;				// indicates if artist insertion point found

	inTmp = new DataInputStream(new BufferedInputStream(new FileInputStream("artist.dat")));
	outTmp = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("tempArt.dat")));

    //
    // the following loop copies the current artist file to a temporary file
    //
    while (inTmp.available() != 0)
    {

		//
		// read a temporary name from the artist file
		//
		tempFn = inTmp.readUTF();
		tempLn = inTmp.readUTF();

		//
		// write the temporary name to the temporary file
		//
        outTmp.writeUTF(tempFn);
        outTmp.writeUTF(tempLn);

    }

    outTmp.close();
    inTmp.close();

	inCopy = new DataInputStream(new BufferedInputStream(new FileInputStream("tempArt.dat")));
	outCopy = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("artist.dat")));

	//
	// copy the temporary file to a new artist file
	// while inserting the new artist name in the proper location
	//
	while (inCopy.available() != 0)
	{

		//
		// read a temporary name from the temporary file
		//
		tempFn = inCopy.readUTF();
		tempLn = inCopy.readUTF();

	    //
		// write the proper record to the artist file in alphabetical order
		//
		if ((compareStr (tempLn, ln) < 0) || found)
		{
		  outCopy.writeUTF(tempFn);
		  outCopy.writeUTF(tempLn);
		}
		else
		  if (compareStr (tempLn, ln) > 0)
		  {
		    outCopy.writeUTF(fn);
		    outCopy.writeUTF(ln);
		    outCopy.writeUTF(tempFn);
		    outCopy.writeUTF(tempLn);
		    found = true;
		  }
		  else
		    if (compareStr (tempFn, fn) == 0)
		    {
			  outCopy.writeUTF(fn);
			  outCopy.writeUTF(ln);
			  found = true;
		    }
		    else
			  if (compareStr (tempFn, fn) < 0)
			  {
				outCopy.writeUTF(tempFn);
				outCopy.writeUTF(tempLn);
			  }
			  else
			  {
				outCopy.writeUTF(fn);
				outCopy.writeUTF(ln);
				outCopy.writeUTF(tempFn);
				outCopy.writeUTF(tempLn);
				found = true;
			  }

	} // while (inFile.available() != 0)

	inCopy.close ();

	//
	// write the artist name to the end of the artist file
	//
	if (!found)
	{
		outCopy.writeUTF(fn);
		outCopy.writeUTF(ln);
	}

	outCopy.close();

  } // addArtist


} // class UserInterface

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩avvvv在线播放| 久久久久久久久久久久久夜| 天天综合日日夜夜精品| 国产精品传媒入口麻豆| 久久久精品一品道一区| 亚洲电影一级黄| 亚洲一级电影视频| 亚洲一区二区三区视频在线| 成人永久免费视频| 韩国精品在线观看| 蜜乳av一区二区三区| 久久国产尿小便嘘嘘| 国产一区二区三区电影在线观看| 国产一区在线观看视频| 欧美日韩成人在线| 日韩一区二区在线观看视频播放| 欧美一区二区三区白人| 精品国产亚洲一区二区三区在线观看| 日韩一区二区在线播放| 亚洲国产精品久久久久秋霞影院 | 欧美韩国日本不卡| 国产精品丝袜久久久久久app| 国产精品对白交换视频| 国产99精品国产| 欧美日韩免费不卡视频一区二区三区| 国产精品久久久久久久久果冻传媒| 国产一区在线视频| 久久蜜桃香蕉精品一区二区三区| 九色porny丨国产精品| 粉嫩av一区二区三区粉嫩| 精品国产人成亚洲区| 国产乱人伦偷精品视频不卡| 在线一区二区三区| 欧美zozo另类异族| 亚洲一区二区三区视频在线播放 | 成人高清在线视频| 欧美精品丝袜中出| 亚洲国产精品99久久久久久久久| 国产一区二区主播在线| 国产精品区一区二区三区| 成人性生交大片免费看中文| 国产精品久久久久久久久晋中 | 成人免费视频网站在线观看| 亚洲欧洲精品一区二区精品久久久 | 91视视频在线观看入口直接观看www | 亚洲欧美乱综合| 久久国产精品99久久久久久老狼| 欧美一区二区久久| 国产精品一区二区久久不卡| 中文字幕一区二区三区在线播放| 91社区在线播放| 日韩高清不卡一区二区三区| 久久中文字幕电影| 看片网站欧美日韩| 日本一区免费视频| 精品综合久久久久久8888| 国产亚洲精品超碰| 久久精品国产第一区二区三区| 日韩免费视频线观看| 蜜臀精品久久久久久蜜臀| 久久午夜国产精品| 在线精品视频一区二区| 久久一区二区视频| 国产成人8x视频一区二区| 一区二区三区加勒比av| 国产精品 欧美精品| 欧美成人一区二区三区片免费 | 久久久www成人免费无遮挡大片| 懂色av噜噜一区二区三区av| 亚洲国产中文字幕| 久久久蜜桃精品| 精品污污网站免费看| 亚洲欧美偷拍另类a∨色屁股| 91精品国产综合久久精品| 一区二区三区免费观看| 精品国产免费一区二区三区四区 | 日韩欧美视频在线| 91麻豆精品秘密| 久久影院午夜论| 日本视频中文字幕一区二区三区| 久久精品欧美日韩精品| 欧美日韩电影在线| 99精品国产热久久91蜜凸| 亚洲国产精品成人综合色在线婷婷| 欧美在线综合视频| 国产成人精品一区二区三区四区 | 成人永久aaa| 麻豆精品久久久| 亚洲午夜激情av| 亚洲日本护士毛茸茸| 91黄色免费版| 99久久精品免费精品国产| 久久不见久久见中文字幕免费| 一区二区三区日韩精品| 中文字幕一区二区三区精华液 | 精品国产电影一区二区| 亚洲欧美韩国综合色| 2欧美一区二区三区在线观看视频| 在线一区二区三区四区五区| 成人小视频免费在线观看| 久久国产精品72免费观看| 日韩高清一区二区| 亚洲成a人片在线不卡一二三区| 亚洲男同性视频| 亚洲人成精品久久久久久| 国产精品久久久爽爽爽麻豆色哟哟 | 91麻豆精品国产| 欧美日韩亚洲综合在线| 欧美日韩一区二区在线观看视频| 一本一道久久a久久精品| 亚洲国产欧美日韩另类综合| 亚洲精品欧美在线| 亚洲精品一区二区三区蜜桃下载| 欧美一区二区视频免费观看| 欧美一区二区三区四区在线观看| 欧美日韩成人在线一区| 911精品国产一区二区在线| 欧美日本在线看| 一区二区三区视频在线看| 国产精品成人一区二区三区夜夜夜 | 久久只精品国产| 国产日韩av一区| 国产精品国产三级国产三级人妇| 国产精品国产三级国产aⅴ入口| 亚洲色图都市小说| 一区二区三区在线观看动漫| 亚洲bt欧美bt精品| 毛片av一区二区| 高清shemale亚洲人妖| 99精品国产热久久91蜜凸| 欧美在线一二三| 日韩亚洲欧美中文三级| 国产日韩v精品一区二区| 中文字幕佐山爱一区二区免费| 亚洲综合av网| 捆绑变态av一区二区三区| 粉嫩嫩av羞羞动漫久久久| 色婷婷综合在线| 日韩视频在线永久播放| 欧美国产一区二区在线观看| 亚洲激情中文1区| 久久国产生活片100| av一区二区三区| 日本va欧美va欧美va精品| 亚洲女人小视频在线观看| 亚洲电影第三页| 狠狠v欧美v日韩v亚洲ⅴ| 不卡的电视剧免费网站有什么| 欧美日韩国产另类一区| 国产亚洲一区二区三区| 亚洲精品亚洲人成人网在线播放| 免费欧美在线视频| www.亚洲免费av| 日韩一区二区三区免费观看| 国产精品毛片a∨一区二区三区| 亚洲国产精品天堂| 国内欧美视频一区二区| 欧美综合欧美视频| 国产亚洲一区二区三区在线观看 | av影院午夜一区| 欧美成人综合网站| 亚洲一二三四在线| 成人深夜福利app| 精品成人佐山爱一区二区| 亚洲国产精品自拍| 丁香婷婷综合色啪| 日韩一级免费观看| 亚洲成人7777| 色诱亚洲精品久久久久久| 国产婷婷色一区二区三区四区| 午夜电影久久久| 日本精品视频一区二区| 国产视频911| 国产在线精品一区在线观看麻豆| 欧美视频中文字幕| 日韩欧美国产精品一区| 亚洲精品美国一| 99国产欧美另类久久久精品| 国产拍欧美日韩视频二区| 美日韩黄色大片| 欧美电影一区二区| 亚洲成人免费观看| 一本大道久久a久久综合| 中文字幕在线观看一区二区| 国产精品一区二区三区四区| 欧美一区二区三区影视| 亚洲国产中文字幕| 欧日韩精品视频| 亚洲日本va午夜在线影院| 99久久精品国产毛片| 国产精品久99| 99久久久久久| 亚洲人成网站在线| 在线一区二区观看| 亚洲国产aⅴ成人精品无吗| 欧美午夜精品久久久久久孕妇| 亚洲综合男人的天堂| 欧美人狂配大交3d怪物一区| 日韩激情视频在线观看| 国产91精品精华液一区二区三区|