public void run() {
		int amountInput = 0;       //统计类的参数最好在一开始初始化
		println ("This program find the largest and smallest numbers.");
		/* set a sentinel number */
		int n = readInt ("? ");
		if ( n == SENTINEL) {
			println ("The program is terminated by your input of the setinel number. ");
		}
		/* variable amountInput is for counting the amount of numbers we've input.
		 * variable largestNum and smallestNum is for the recording of the largest and the smallest number respectively.*/
		int largestNum = n;
		int smallestNum = n;
		while (n != SENTINEL) {
			amountInput ++;
			if (n > largestNum){
				largestNum = n;
			}
			if (n < smallestNum){
				smallestNum = n;
			}
			n = readInt ("? ");      //把读取放在while循环的最后，能避免使用break语句。并且，在你的版本里，amountInput的逻辑不直接。
		}
		/* reports the result of the largest and the smallest numbers. */
		if (amountInput != 0){
				println ("smallest: " + smallestNum);
		        println ("largest: " + largestNum);
		}
  }