class CompareNumbersWhileLoops {
  public static void main(String [] args) {
    // Use only "while loops" in this program.
    // first ask the user how many numbers they wish to compare
    System.out.print("How many number do you wish to compare? ");
    int max = In.getInt();
    
    // now:  1) get the numbers and determine the highest one.
    //       2) then modify the program to determine the lowest number as well.
    //       3) finally, modify the program to determine the mean value.
    
    int count = 0;
    int highest = 0;
    int lowest = Integer.MAX_VALUE;
    int totals = 0;
    // print out the information you have determined
    while (count < max) {
      System.out.print("please enter a non-negative integer: ");
      int intIn = In.getInt();
      if (intIn > highest) {
        highest = intIn;
      }
      if (intIn < lowest){
        lowest = intIn;
      }
      totals += intIn;
      count++;
    }
    
    System.out.println("The highest number is " + highest);
    System.out.println("The lowest number is " + lowest);
    System.out.println("The meanest number is " + ((double)totals / max));
  }
}