import SimpleInput;
import SimpleOutput;


public class arrayExample {
    // class reads 10 integers, prints them in reverse order, and
    // finds their maximum and minimum

    public static void main (String args []) {

        // declare needed objects
        SimpleInput in = new SimpleInput();
        SimpleOutput out = new SimpleOutput();

        // Other declarations
        final int Number = 10;  // declare constant -- number of integers
        int[] values = new int [Number];     // array of elements
        int i;         // loop index

        // read values from keyboard
        out.println ("Enter " + Number + " integers on separate lines.");
        for (i = 0; i < Number; i = i + 1) {
            values[i] = in.readInt();
        }

        // print values in reverse order
        out.println ("The numbers in reverse order are");
        for (i = Number-1 ; i >= 0; i = i - 1) {
            out.print (values[i] + "  "); // print values on same line
        }
        out.println(); // move to new line
        
        // compute maximum and minimum
        int maximum = values[0];
        int minimum = values[0];
        for (i = 1; i < Number; i = i + 1) {
            if (maximum < values[i])
                maximum = values[i];
            if (minimum > values[i])
                minimum = values[i];
        }

        out.println ("The maximum value entered is " + maximum);
        out.println ("The minimum value entered is " + minimum);
    }
}
